Forum Moderators: coopster
So my question is... will all scripts run with no issues after an upgrade, or is there a chance that things will stop working?
If not everything will run under php5, is there an "easy" way to check my files for outdated code? Some kind of program to run that will scan files for code that won't run as expected... I have tons of scripts, so doing a manual check is simply not possible from a practical point of view.
If your scripts were written in the last couple of years you are likely to be fine; but if your scripts are legacy scripts which were patched from PHP3 to work with PHP4 then you will probably have serious problems.
Many years ago, back in the mists of time, all programmers were instructed not to make use of automatically registered global variables in PHP; despite this there is still a lot of code which 'requires register_globals to be on'. To see if that's the case for you; test it by turning register_globals to off in your PHP4 installation. If things break; you'll never survive PHP5.
<?=//$var."Something";?>
the comment right after a shorthand echo made things error out on me.. no big deal.. but everything had to be updated (Loves Find and Replace All) :D
Due to the Halting Problem or Turing Completeness or some fancy computer terminology like that, it is impossible to scan your PHP files to determine if they will work to an absolute certainty. Your best bet, as has been mentioned, is to put your scripts on a PHP5 server and try them out.
Having made the move from PHP4 to PHP5 myself, I can point you to the problems I had:
class y { ... }
class x { function x() { $this = new y(); } }
$x = new x(); function f () { array_shift($args = func_get_args()); }
f(a, b, c); Object Copying
$ob1 = new O(...);
// some $ob1->foo = bar; initialization
$ob2 = $ob1; // make a copy!
$ob1->setSomething("x");
$ob2->setSomething("y"); Your problems may be different, but you would be well-advised to expect something will go wrong. Murphy's Law and all that.