[PHP-BUG] Req #73980 [NEW]: PHP error reporting is less strict for bools access as array than for arrays
[email protected] ("benp at yelp dot com") Mon, 23 Jan 2017 14:36:29 GMT
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: benp at yelp dot com Operating system: PHP version: 7.1.1 Package: PHP Language Specification Bug Type: Feature/Change Request Bug description:PHP error reporting is less strict for bools access as array than for arrays Description: ------------ This is well-known from long-past bugs e.g. https://bugs.php.net/bug.php?id=41195, but it really should be reconsidered at some point for future language versions. It's pretty nuts that undefined offset access is more strict for arrays than it is for booleans (and other objects). Booleans should probably be able to complain about being accessed as arrays. Test script: --------------- <?php error_reporting(E_ALL); $boolean = true; $array = []; $boolean['hello']; // No error $array['hello']; // E_NOTICE Expected result: ---------------- $boolean['hello'] should throw some error. -- Edit bug report at https://bugs.php.net/bug.php?id=73980&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73980&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73980&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73980&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73980&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73980&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73980&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73980&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73980&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73980&r=support Expected behavior: https://bugs.php.net/fix.php?id=73980&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73980&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73980&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73980&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73980&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73980&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73980&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73980&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73980&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73980&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73980&r=mysqlcfg