Upgrading from PHP 5.2 to PHP 5.3 - Fault tolerant changes - how easy is it to detect?

I want to upgrade a large PHP site from 5.2 to 5.3 and possibly further.

The legacy code base I'm working on is very large, 800,000 lines of code and basically looks at a list of incompatible changes in the opposite direction ( http://php.net/manual/en/migration53.incompatible.php ), most of these problems can be easily found by searching for strings in strings, but others (for example, by reference and API changes) are harder to search for. I used codeniffer to try to identify broken areas of code, but codeniffer does not seem to find everything (e.g. links to links and API problems not found, for example).

Essentially, what I need is a way to easily identify the affected code that the code might have missed, without having to run all the code or read all the code. Is there a tool that can significantly scan the code and tell me about problem areas and save weeks / months?

Any ideas? I forgot to mention that we use IIS / Windows, if that matters.

+4
source share
1 answer

Most of the problems that are clearly incompatible with the reverse side (as indicated on the page you linked to) are fairly easy to find by hunting for the specific features mentioned on this page. This is a relatively short list, and all changes are quite specific. It’s not easy to navigate through them, even in a large code base, and most of the changes listed are cases with edges, so I hope you don’t have to worry too much from this list.

The big problem is with the list of functions that are deprecated in 5.3 . This includes the link-to-link feature specified in the question.

Some of these functions are difficult to find only by searching for code, especially for a large code base, and if the code exists for some time, the probability is very high, of them.

The good news is that you can safely run your code in 5.3 without affecting legacy functions. Functions are deprecated; this means that they were marked as bad, but in fact they have not yet been removed from the language (which for most of them is 5.4), so with respect to these functions your software will work the same way as before, except that it will trigger warning messages.

So, the best way to find all these things in your code is to simply upgrade to 5.3, run your code and catch all the warnings that appear in your error log.

Obviously, you will need to do some pretty comprehensive tests to make sure you find everything, but this is not necessarily a bad thing. In fact, frankly, you would be a fool to not do this if you were updating the language version for a system of this size. Perhaps you could use this as an opportunity to start writing those test scripts that you have not yet been able to get around.

+2
source

All Articles