ext/usim – The PHP Upgrade Simulator

For half a year now I was working on a secret project called “PHP Upgrade Simulator” or short ext/usim which is a PHP extension that allows people to evaluate how robust their PHP code base is when it comes to upgrading to future PHP versions. I am happy to announce that after several months of work the project is now ready for a version 1.0.0 release.

The idea of the project is very simple. During a PHP upgrade there is always the possibility that some bug was introduced, some behaviour changed, some crash was introduced, some functions got deprecated. This possibility can be measured from past statistical values and interpolated into the future to simulate an update.

At this point I want to thank all the members of the PHP community that helped me reviewing the bug reports from the last 5 years to gather information about the likeliness of each incident. It was hard work, but it was worth it. In the end we developed a formula that determines how likely one of the incidents is given a certain delta in the version number.

To use the extension you simply have to compile, load and configure it like every other PHP extension. The configuration directive is called usim.upgradeversion. You just set it to whatever version you want to simulate.

usim.upgradeversion = 5.4.17

From that point on your PHP installation will behave like an interpolated PHP 5.4.17. The following features are supported:

  • Important functions are suddenly deprecated
  • Deprecated functions are removed
  • Not deprecated functions are removed (e.g. move to PECL)
  • Introduction of random crashes (on shutdown, during functions, on function call)
  • register_globals and magic_quotes_gpc randomly turned on and off
  • safe_mode removed
  • Leaking of .ini directives to other VHOST (e.g. open_basedir)
  • Introduction of new keywords or classes which collide with popular names
  • Random change of the namespace separator character during minor upgrades
  • Change of default memory_limit

The PHP Upgrade simulator is available here for download. Have fun with it.