Bug #68110 [Opn]: undefined variable error not being triggered for undefined array index

[email protected] ("mathiasgrimm at gmail dot com")
Newsgroups php.standards
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=68110&edit=1

 ID:                 68110
 User updated by:    mathiasgrimm at gmail dot com
 Reported by:        mathiasgrimm at gmail dot com
 Summary:            undefined variable error not being triggered for
                     undefined array index
 Status:             Open
 Type:               Bug
 Package:            PHP Language Specification
 Operating System:   OSX, Windows, Linux
 PHP Version:        5.5.17
 Block user comment: N
 Private report:     N

 New Comment:

actually the expected result is Undefined index: b... or to have the variable $php_errormsg defined.


Previous Comments:
------------------------------------------------------------------------
[2014-09-26 21:24:03] mathiasgrimm at gmail dot com

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 this bug report at https://bugs.php.net/bug.php?id=68110&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.