Upgrading from PHP 5.1 to PHP 5.3

I am currently studying the viability of upgrading my site from PHP 5.1.6 to 5.3.10. The site runs on CentOS.

I am aware of major differences, such as the introduction of namespaces and closures. I also spent some time on “backward compatibility changes” in migration guides that look good, and I will spend a considerable amount of time.

Are there any "gotchas" that I should follow?

+4
source share
2 answers

I recently made the switch to 5.3.x and noted the following issues (from mine:

date.timezone (php.ini):

  • PHP developers have reduced the level of errors from strict to warning, so you will see many warnings about any date functions if you do not have this set correctly.

Example:

date.timezone = America/Los_Angeles 

__ ToString ():

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

As mentioned in the comments, you better go to 5.3.10 and then go to 5.4.1 or even 5.4.2. Jumping to 5.4.0 right away is not a good idea, and you will understand why when they publish the change log for 5.4.1.

+3
source

I had to download MediaWiki 1.15.1 to PHP 5.3 because I was updating it (here) . Then the development team was “let go” in the transfer, so volunteers from the community needed to intervene to do this. MW Developers Council: "MW1.15 is incompatible with PHP 5.3, upgrade to MW 1.17"

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

The main problem was that "The behavior of the functions using the reference parameters called by the value has changed. If the function previously accepted the by-value argument, now a fatal error is emitted." In other words, 5.1 and 5.2 had inaccurate tolerance here, and 5.3 with a fatal error. Detecting all of these statically was simply impractical, so this was a case of trying to implement common paths by twisting the error logs to expand and find dozens of cases when this happened, and check against the documented APIs to fix each case case basics. I cannot think of any other incompatibility that has burned.

+1
source

Source: https://habr.com/ru/post/1400045/


All Articles