One month ago, PHP 5.4.0 was released - bringing PHP yet another step closer to the next PHP 6. So what does this mean for our Yireo extensions? Is it time to migrate yet?

Coding under PHP 5.4

Programming with PHP 5.4 is actually not that different than under PHP 5.3. Yes, there are some changes in the support functions - for instance a function lke session_register() and session_unregister() are now removed. But because these functions were deprecated already for some time, keeping PHP-code up to date for 5.3 compatibility implies little changes with PHP 5.3.

Magento extensions and PHP Strict

Magento by default sets error reporting to the maximum, meaning that any PHP notice or PHP warning is actually fatal: The PHP application stops when it encounters any problem. Because of this, Magento code is generally properly coded for PHP 5.3 and therefor PHP 5.4 is a very minor step: We have started testing our Yireo extensions for Magento and actually have encountered zero problems so far.

Joomla! extensions and PHP Strict

With Joomla!, the error-reporting level can be configured through the Global Configuration, but by default it takes over the system default value. An unmodified PHP 5.3 environment was displaying errors in a non-strict standard, but PHP 5.4 adds the E_STRICT level to this. This basically means that a lot more error-messages might display, if PHP-code is not programmed following the PHP-strict standards. It is still possible to configure PHP to run in a non-strict mode, but the whole point of E_STRICT messages is that those errors should be fixed, not ignored.

Because strict-mode never was an issue, a huge bunch of our Yireo extensions were coded in non-strict mode. This has to change. In the next months we will therefor focus more and more on programming all Joomla! extensions with E_STRICT messaging enabled, trying to fix all those (minor) errors along the way. Our first point of focus will be MageBridge, but all other Joomla! extensions will follow.

Our advise on upgrading

Because Magento is already running with a PHP Strict mode, upgrading to PHP 5.4 should not be that difficult. Ofcourse, upgrading PHP is not a minor step, so proper testing is needed - probably by running the test environment for some time under PHP 5.4, before migrating the production environment as well.

Joomla! poses a bit more problems: Only recently, Joomla! 2.5 has started to make sure that the used PHP-code was strict, so notices and warnings are absent. But there is still a huge number of extensions not coded following the PHP 6 standards, so this requires a lot of work. Instead of thinking about migrating to PHP 5.4, it's better to simply modify the Global Configuration of your testing environment and set error reporting to the maximum: This will display any error: It's probably best to fix those errors before migrating to PHP 5.4. (But you could also run Joomla! under PHP 5.4 and just ignore all errors by setting error reporting to none.)

Posted on April 5, 2012

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.