From: Operating system: Linux, Windows PHP version: 5.3.6 Package: Variables related Bug Type: Bug Bug description:Treating null, boolean and numbers as arrays does not trigger an error
Description: ------------ This bug is really annoying and generates many headeaches to millions of php developers. It's really hard to detect this bug sometimes, and that is because we have so much faith in PHP and we think that it's not possible that php would allow us to write such a nonsensical code and not throw an error, after all didn't we set the most strict error reporting you allow us to set? This example code should be self explanatory: <?php error_reporting(-1); // The most strict error reporting. $n = null; echo $n[12]; // That should generate at least a E_NOTICE or E_STRICT warning. $f = false; echo $f[12]; // No error. $t = true; echo $t[12]; // No error, again. $a = 4; echo $a[12]; // Oh really, again no error? What a surprise! $a = 4.44; echo $a[12]; // And what do you think?! Guess! No error! ?> Please fix it ASAP. Thank you for your time. -- Edit bug report at http://bugs.php.net/bug.php?id=55032&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=55032&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=55032&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=55032&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=55032&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=55032&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=55032&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=55032&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=55032&r=needscript Try newer version: http://bugs.php.net/fix.php?id=55032&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=55032&r=support Expected behavior: http://bugs.php.net/fix.php?id=55032&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=55032&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=55032&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=55032&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=55032&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=55032&r=dst IIS Stability: http://bugs.php.net/fix.php?id=55032&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=55032&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=55032&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=55032&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=55032&r=mysqlcfg