I've been testing all day with PHP 5.1.2. It is not completely backward compatible with 5.0.4 and 4.4.x. Here are the problems I've run into.
When going from 4.4.x to 5.0.4, I found that sessions are not saved if you do anything "non-standard" (whatever that means) with the $_SESSION variable. Doing certain things makes it lose its "magicness". It seems they are not going to fix this since 5.0.x has been superseded by 5.1.x http://bugs.php.net/bug.php?id=35192 http://bugs.php.net/bug.php?id=33811 Even odder, a workaround is to set register_long_arrays in php.ini to On, then it keeps this bug from cropping up. Unfortunately, while the above is fixed in 5.1.2, it has the following problems: You can't do: list($a, $b) = $b where you use a variable as both an lvalue and an rvalue in the same expression. Doing so is usually an undefined operation in most languages it seems, so they were free to change it. This has to be converted to: list($a, $x) = $b; $b = $x; It has to do with the way lvalues and rvalues are resolved within the expression using references. (in my opinion, this is really busted). http://bugs.php.net/bug.php?id=35560 http://bugs.php.net/bug.php?id=35277 The other problem I found but which did not bite me is the construct: function x( &$a ) { } x( $var = value ) Function x receives $a as a reference. In some cases might generate a parse error depending on the type of value (or version of PHP), in others $var will seem to not have been modified after the call to x() (because the assignment to var is made after x() returns). I don't have a bug data entry for this one, but it's in there. When going from php4 to php5, there is a pear collection called PHP_Compat that you can use to get some php5 things in php4 (mostly constants and functions). You don't need to install this via pear, you can just put in your include_path and include the functionality you need. One thing I was needing is clone, but PHP_Compat's clone implements a deep copy, unlike PHP5's which, according to the docs, implements a shallow copy. This might or might not be a problem for you. It's odd that the PHP_Compat version even does anything here since the default object assignment on PHP4 is a shallow copy (which is what PHP5's clone does). There are also some syntax oddities to watch out for (for example, clone in php5 is a keyword, but in PHP_Compat it's a function so you need to put () around the argument (this is forward compatible, but looks stupid)). A lot of stuff will be caught if you turn on E_STRICT, but if you make all those changes (like specifying private, protected or public instead of var for class variables) your code might not run under PHP4, if that's important. Thankfully, trustix's php installation allows one to switch easily between php4 and php5 (still needs a server restart, but both can be installed at the same time) for testing purposes. -- Andy Bakun <[EMAIL PROTECTED]> _______________________________________________ tsl-discuss mailing list [email protected] http://lists.trustix.org/mailman/listinfo/tsl-discuss
