Breaking PHP


I've been upgrading my newspipe web front-end and a couple of other minor things to PHP5, and have reached a few interesting conclusions:

  • Bog-standard procedural (i.e., non-OO) code will seldom break.
  • Anything using funky extensions (or XML handling, or relying on any sort of reflection or inspection (such as is_a, which has been replaced by instanceof) will break.
  • Heavily object-oriented code (such as most of my stuff) will work provided you're aware of these changes, but when it breaks (and it will), it will do so in strange and unfathomable ways until you get the hang of it.
  • Just for kicks, I also confirmed that PhpWiki crashes and burns horribly when run under a modern Apache and PHP build (at least my modified codebase, which is pretty damn old), given that it's crammed with static methods, funky PEAR dependencies, and a few inheritance chains longer than my arm.

It all boils down to the fact that the new PHP5 object model completely murders all the neat tricks we had to do to get the old object model to work. As for me, I've decided that re-factoring all that old code is simply not going to happen.

So I've replaced three of my small PHP applications with Snakelets-based counterparts, taken yet another look at my NewWikiMigration notes, and am pruning all the junk under my Yaki Subversion tree and moving from Ruby to Python and Snakelets.

Although I've come to realize that pretty much nobody in the Python community even knows that Snakelets exists, I'm pretty happy with it so far. Of course, its lack of WSGI support is a bit of a concern as far as future-proofing goes (especially in a server dominated by lighttpd lobbyists), but I'm confident I can get around that if the need arises if I write my own code properly.

Now all I need is enough time to do it...