crmpicco
crmpicco

Reputation: 17181

upgrading from PHP 5.1 to PHP 5.3

I am currently investigating the viability of upgrading my site from PHP 5.1.6 to 5.3.10. The site is running on CentOS.

I am aware of the major differences such as the introduction of namespaces and closures. I've also spent some time going through the "Backward Incompatibility Changes" on the Migration Guides which look good and will be where i'll be spending a considerable amount of time.

Are there any "gotchas" that I should keep an eye out for?

Upvotes: 4

Views: 4109

Answers (2)

Mike Purcell
Mike Purcell

Reputation: 19979

I recently made the jump to 5.3.x as well and noted the following issues (sourced from my blog):

date.timezone (php.ini):

  • PHP developers decreased the error level from strict to warning, so you will see numerous warnings around any date functions if you do not have this set correctly.

Example:

date.timezone = America/Los_Angeles

__toString():

  • In PHP 5.3, the magic __toString() methods no longer allow you to pass in arguments, which makes sense on some level, but does reduce flexibility.

As mentioned in the comments, you are better off upgrading to 5.3.10, then migrating to 5.4.1 or even 5.4.2. Immediately jumping to 5.4.0 is not a good idea, and you will see why when they post the changelog for 5.4.1.

Upvotes: 3

TerryE
TerryE

Reputation: 10888

I had to get a MediaWiki 1.15.1 working on PHP 5.3 because I was rehosting it (here). The then dev team had been "let go" in the hand-over, so it the community volunteers needed to step in to do this. The MW developers advice was "MW1.15 is not compatible with PHP 5.3; upgrade to MW 1.17"

For various reasons related to custom extensions and the need to stick with MW 1.15 schema as a stepping stone, I had to stick with MW 1.15. Man, was it a pain!!!!

The main issue was the "The behaviour of functions with by-reference parameters called by value has changed. Where previously the function would accept the by-value argument, a fatal error is now emitted." In other words 5.1 and 5.2 had a sloppy toleration here and 5.3 would barf with a fatal error. Finding all of these statically was just impractical so it was a case of trying to exercise of common paths, mining the error logs to drill down and find the dozens of cases where this happened and check against the documented APIs to fix each on a case by case basis. I can't think of any of the other incompatibilities that burnt.

Upvotes: 1

Related Questions