Someone came to me yesterday and asked me to have a quick look at his PHP, because his autoloaders were no longer working after he upgraded to PHP 5.3.
Warning: Illegal offset type in isset or empty in /var/www/crazycode.ws/wp-includes/query.php on line 1715
Someone came to me yesterday and asked me to have a quick look at his PHP, because his autoloaders were no longer working after he upgraded to PHP 5.3. Here is an example of what he had:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <? echo 'PHP Version: ' . phpversion() . '</br>'; function __autoload($classname) { echo 'Loading class: ' . $classname . '</br>'; eval("class $classname { function __construct() { echo '$classname'; } }"); } $foo = new Foo(); ?> |
Now, the only reason (after 30 minutes of staring through almost 15 files) why his code was not working was because he was using short tags. As soon as the first line was changed to:
1 | <?php |
everything magically just started working once again.
So let this be a reminder: when php.ini tells you that something is going to be deprecated, please, pretty please don’t go and ignore it!
Related posts:





2 Responses
Ahhh the bane of short tags. Too bad it took PHP 5.3 to realise how naughty he was!
The only sad thing was the fact that it was only after a long time staring at *cough*spaghetti_code();*cough* was the cause discovered.