Supporting PHP – What a Pain

Today I decided to tackle something that I had decided needed doing. After discussing the migration to the new forum with my web guru, he pointed out that we would lose all the back links and indexed entries from Google and other search engines if we broke the URL path. The original reason we put a new forum plug-in up was because the old Newsportal software broke on PHP5.3, which was required by the newest release of WordPress. My guru suggested that it couldn’t be that bad to fix, it should mainly just run.
Famous last words. As it turns out, the software was actually faulty in various ways, probably in most respects because of changes that PHP5 has made that break things that worked before. Just to give you a feeling for it, older PHP programs used: <? to begin a chunk of PHP code inside of a section of HTML. In PHP5, it seems you have to use <?php to do that. This meant tracking down every single place that PHP code was being inserted throughout, as well as places where it was being added into the web page by some other chunk of PHP code. To say the least, it was spread far and wide. At least the closing tag hadn’t changed.
Then, on top of all those changes, they were all kinds of other places in the code that just plain didn’t work. It seems that some convention of inserting one-liners using PHP that worked before wasn’t working now, and I had to figure that out and alter them all. Also, the original code had numerous errors that were being ignored by PHP4 but which showed up loud and clear in PHP5. I ended up having to fix quite a few errors in the code. Also, in some places functions were being used that were deprecated, but for which there were drop-in compatible replacements; so why didn’t they just leave the original function there and have it call the new one if the old one needed replacement? If they really were that compatible – split() is deprecated and now you use explode() – why not just fix split() instead of creating a new one? Didn’t these people ever hear of backwards compatibility?
Oh well, rant over. The work took hours, but it is now done. I have a reworked copy of Florian Amrhein’s Newsportal that works in PHP5 and which has numerous bugs removed. If somebody really needs it, let me know and I will try and package up the changes.