![]() The more noisy your logs are, the harder it is to find actual issues in them. How do you find coding issuesĮnable the syslog module, and tail that in your development environment, hunt down and fix as many notices and warnings as possible. The reason being that drupal_render() expects a variable to be passed in (as it is passed by reference). The fix is to simply use a temporary variable: $view = node_view(node_load(1), 'teaser') This code works in PHP 5.3, but will throw notices in PHP 5.5: $rendered = drupal_render(node_view(node_load(1), 'teaser')) Where you will likely find this in Drupal in my experience is when manually rendering nodes: Strict Standards: Only variables should be passed by reference in php shell code on line 1 PHP Strict Standards: Only variables should be passed by reference in php shell code on line 1 Php > var_dump(reset(explode('|', 'Jim|Bob|Cat'))) Only variables can be passed by reference If you have this in your code, you will have a bad time, as this is now a PHP fatal. Here are some links you should read:īelow are some of the most common issues I have found in sites: Call time pass-by-reference Be aware, once you upgrade beyond PHP 5.3, you cannot downgrade, so ensure you test your code on a development server first ) Common coding issuesĪlthough Drupal 7 core, and most popular contributed modules will already support PHP 5.5, it would pay to do a code audit on any custom code written to ensure you are not using things you should not be. More information can be found in the documentation. If you use Acquia Cloud for hosting there is a convenient PHP version selector in the UI. It would be worth considering a dist upgrade though, but this at least can buy you some time. If you are running the older Ubuntu Precise 12.04, you can add a PPA sudo add-apt-repository ppa:ondrej/php5 This is probably the best solution if you are managing your own Ubuntu box. Ubuntu Trusty Tahr 14.04 (which is an LTS version), which comes bundled with PHP 5.5.9. There are a number of ways to update your server to PHP 5.5. Read through the list of new features, here are some neat things you are missing out on:Īnd many others. PHP 5.5 offers more performance again, and there is a section at the bottom of this article that goes through a real life scenario. ![]() PHP profiled the 5.4 release compared to 5.3 for Drupal, and that found that: PHP 5.5 is the first version that bundles an opcode cache with PHP, this means there is also no need to also run APC (unless you need userland caching in APCu). PHP 5.3 reached end of life in August 2014, this means that if you are running this version, you are running an insecure version of PHP that potentially has security holes in it. If you are looking for reasons to ditch PHP 5.3, here are some: Security ![]() This post is a follow up to my previous blog post on how to upgrade PHP to 5.4 to support Drupal 8.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |