[PHP-BUG] Bug #68110 [NEW]: undefined variable error not being triggered for undefined array index
[email protected] ("mathiasgrimm at gmail dot com")
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: mathiasgrimm at gmail dot com
Operating system: OSX, Windows, Linux
PHP version: 5.5.17
Package: PHP Language Specification
Bug Type: Bug
Bug description:undefined variable error not being triggered for undefined array index
Description:
------------
according to the
manual(http://ie1.php.net/manual/en/language.types.array.php):
Note:
Attempting to access an array key which has not been defined is the same
as accessing any other undefined variable: an E_NOTICE-level error
message will be issued, and the result will be NULL.
Test script:
---------------
$a ['a'] = null;
$tmp = $a['a']['b']; // nothing
$tmp = $a['a']['b']['c']; // nothing
// this works (throw an E_NOTICE) fine
$a ['a'] = array();
$tmp = $a['a']['b']; // Undefined index: b
$tmp = $a['a']['b']['c']; // Undefined index: b
Expected result:
----------------
assert(isset($php_errormsg) === true);
Actual result:
--------------
Undefined index: b
--
Edit bug report at https://bugs.php.net/bug.php?id=68110&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68110&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68110&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68110&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68110&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68110&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68110&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68110&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68110&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68110&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68110&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68110&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68110&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68110&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68110&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68110&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68110&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68110&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68110&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68110&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68110&r=mysqlcfg