ext/usim - The PHP Upgrade Simulator

December 9th, 2008 | by Stefan Esser |

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.

  1. 24 Responses to “ext/usim - The PHP Upgrade Simulator”

  2. By Hans Nordhaug on Dec 9, 2008 | Reply

    Very funny indeed - I thought it was 1st of April for a while.

  3. By gasper_k on Dec 9, 2008 | Reply

    Hi,

    this looks like a very useful tool, I’ll be sure to check it out. Does this by any chance work on PHP4? Not that I’m personaly interested, because we’ve moved to v5 a few years ago, but I believe a lot of people would find it useful.

    PS. removed by admin

  4. By Robin on Dec 9, 2008 | Reply

    Big LOL!

  5. By Jay on Dec 9, 2008 | Reply

    Thanks for rickrolling me, I should have paid more attention while reading the “features”-list, instead of just clicking on every link crossing my way… the internet taught me ;D Serves me right, then :D

  6. By Robert Lippert on Dec 9, 2008 | Reply

    Erst PHP 5.4.17 und dann diese 80er-Föhnfrisuren … das ist hart …;-)

  7. By Marc Gear on Dec 9, 2008 | Reply

    Awesome - this is just what I need - Thanks Stefan.

    I particularly like the idea of introducing new keywords and classes. Namespace clashes are my favorite sort of error.

  8. By Jan Schneider on Dec 9, 2008 | Reply

    That would have been a nice one for April 1st. :-D Thanks for a good laugh in the morning.

  9. By fkm on Dec 9, 2008 | Reply

    Cool! This is indeed very useful.

  10. By Lukas on Dec 9, 2008 | Reply

    :-)

  11. By kuza55 on Dec 9, 2008 | Reply

    Troll :P

  12. By flo on Dec 9, 2008 | Reply

    What’s with the link? It points to Youtube!?

    The idea sounds great!!

  13. By Piccolo Principe on Dec 9, 2008 | Reply

    Maybe I don’t get the point, but how can a codebase be robust against deprecating of functions and random crashes?

  14. By Corni on Dec 9, 2008 | Reply

    Unfortunatly, the download link doesn’t seem to work :P
    And I guess, the formula is horrible, as the amount of new bugs and crashes in each new release is unbelievable :P

  15. By Karl on Dec 9, 2008 | Reply

    Nice rickroll. ;)

  16. By Ivo on Dec 9, 2008 | Reply

    haha, unbelievable to see how many people fail to see the irony/sarcasm in the post :)

  17. By Stefan Esser on Dec 9, 2008 | Reply

    @Piccolo Principe:

    As long the function is only deprecated there is only one problem: your application must handle the warning thrown by the function call and suppress it.

    Handling random crashes etc. is handled by the ACID principle. Your code should use transactions when necessary.

  18. By Anon Coward on Dec 10, 2008 | Reply

    Yay, I just got rickrolled.

    http://en.wikipedia.org/wiki/Rickrolling

    The five posters above should be ashamed.

  19. By Steffen on Dec 10, 2008 | Reply

    I really like your extension, I can’t imagine how I was able to code and test without it, as PHP updates are always Serious Business.
    But I think you forgot to simulate one important aspect: the occasional change of behaviour of a core function, like substr(). (http://bugs.php.net/bug.php?id=41375) No application can be really robust without expecting such changes in critical functions, and dealing with it by… uh… using only arithmetic operations and working on a big array of numerical values.

  20. By Dominik Jungowski on Dec 10, 2008 | Reply

    “Random change of the namespace separator character during minor upgrades”

    LOL :D

    Seems like a really useful tool indeed. I wish we already had such a tool, when migrating from PHP4 to PHP5

  21. By Martin Probst on Dec 10, 2008 | Reply

    Guys, wake up and use a proper language that has maintainers that deserve the name.

    Nothing against crash testing your proper use of transactions, but if you have to expect random core functions or language changes on upgrade, that’s just ridiculous.

  22. By Evert on Dec 10, 2008 | Reply

    I totally fell for that arghhh

  23. By Bernhard on Dec 11, 2008 | Reply

    A PHP code randomizer wouldn’t have taken that long to program. ;)

    Dilbert: “It’s your turn.”
    ‘puter: *shuffles* - “How was I?”
    Dilbert: “Not good. You just programmed a web browser.”

  24. By jlz on Dec 18, 2008 | Reply

    Use python if you want something like this!

  1. 1 Trackback(s)

  2. Dec 9, 2008: Wagner Elias - php, Estefan Esser, e a saga

Post a Comment