wrench and bolt.320
PHP tightens your code

PHP bug-fixes help your code

Ever wondered which PHP bug-fixes help your code? What is the actual impact of a PHP minor version on your code ? Every month, or more, PHP provides a new version, covering about thirty bugs and various upgrades. Sometimes, features request make it to a version. Still, who has time to review the whole changelog before upgrading ?

If you don’t have time to review it, update PHP whenever it is published, and be safe. This is the best way to be as safe as possible. Incompatibilities between minor versions are very few : small increment leads to rare bugs, and to an easy migration. If you’re already keeping track with PHP versions, you may even stop reading this article. If you’re curious to know where you code may break with a new PHP version, keep reading.

To know exactly which bug fixes may impact your code, you need to read the PHP Changelogs : PHP 7 , or PHP 5. You may even check for the NEWS file, where the upcoming PHP version is being prepared.

There, bug fixes have a name, and are generally prefixed with: ‘Fixed bug #69989’. Bug number may be used directly on the PHP bugs web site: https://bugs.php.net/69989. The bug page often has a bug description, and some reproduction code that will help understand which kind of code is triggered an error.

Static analysis helps with bug-fixes

This whole process is long and unrewarding. Thankfully, it may be automated with Exakat’s new feature : features being modified in a bug-fix is looked for in your code and reported. For example, Fixed bug #71201 (round() segfault on 64-bit builds) is reported if the ’round’ function is called at least once in the code. This applies to PHP 5.6 and 5.5 versions, providing a list of impacted features.

php-bug-fixes

See it directly in action with phpmyadmin, atoum and slimphp.

This gives a closer look at the code and what minor version is impacted.

Exakat to support PHP 7.1

Currently, exakat targets PHP native functions as long as they are altered during a bug-fix. That covers about half the modifications in a PHP version. We are working to add extra impacted features, such as ‘Memory leak with consecutive yield from’ or ‘Bad method called on cloning an object having a trait’ which are linked to a feature. A third of PHP bugs are not related to code, like ‘Can’t compile php_curl statically’ ; or difficult to link to code, like ‘Segfault in zend_fetch_string_offset’.

Exakat is currently support PHP 5.5, 5.6 and 7.0 for bug fixes. We have plans to add PHP 7.1 (or more generally, dev) based on the information from current work on the PHP source. That will help spot upcoming modifications, even before the version is released.

The Exakat engine provides the most in-depth static analysis for PHP code.