PDA

View Full Version : Check backwards compatibility


kizman
01-24-2006, 09:58 AM
Hi,

This is the situation:

I've developed a PHP application based on version 5.

Now I need to change the web hoster because of a missing functionality in the hosting package.
I've found one which fits my requirements almost perfectly. Unfortunately their version of PHP is 4.3.x.

I would need to adapt my PHP script so that it is compatible with lower version, but this is a huge work!
Actually I am wondering if there is a tool which would allow me to check the backwards compatibility of my script, and would pinpoint the differences to adapt.

Does something like that exist?

Thanx for your help!

fci
01-28-2006, 02:08 AM
you could install xampp from here:
http://www.apachefriends.org/

then you would be able to test your code against php4, (xampp comes with 4 and 5, you will need to change a setting to make it use php4 though[run a certain batch file, I think..]).

Depending on what you coded, it could very well break your entire app in php4.

Velox Letum
01-28-2006, 06:33 PM
There isn't too many differences between the two, it should be rather easy to convert to PHP4. If you're using classes, remove all the public, private, protected vars and just define them using var $varname;, then remove the functions specifications (public, private, etc.). Any functions that are only PHP5 are usually just improvements of existing functions, like file_put_contents(), and could be replaced relatively easy.

dumpfi
01-28-2006, 10:20 PM
Sorry Velox, but there is more to the list of incompatibilites, e.g.:
objects passed by value no interfaces, abstract classes / methods, instance operator, etc. no exceptions no PHP5 APIs (e.g. Reflection API) many other things I'm not aware ofSome of these problems aren't easily solved. However, if you haven't done much the OO-way, you do not need to worry about most of them.

dumpfi

Velox Letum
01-29-2006, 12:38 AM
That's true. I usually don't use most of the fancy new PHP5 stuff. Unless its much better, I prefer to to be old school with the code. Try-catch blocks I like though.

missing-score
01-29-2006, 12:41 AM
I know I probably shouldn't be advertising, especially as I am a moderator and all, but I run a dedicated PHP 5.1.2 server (link in my signature). If you are interested please do get in contact with me.