note 115819 added to language.types.array
| From: | mathiasgrimm at gmail dot com | Date: | Mon, 29 Sep 2014 16:20:24 +0000 |
| Subject: | note 115819 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200545@lists.php.net to get a copy of this message | ||
<?php
$a['a'] = null;
$a['b'] = array();
echo $a['a']['non-existent']; // DOES NOT throw an E_NOTICE error as expected.
echo $a['b']['non-existent']; // throws an E_NOTICE as expected
?>
I added this bug to bugs.php.net (https://bugs.php.net/bug.php?id=68110)
however I made tests with php4, 5.4 and 5.5 versions and all behave the same way.
This, in my point of view, should be cast to an array type and throw the same error.
This is, according to the documentation on this page, wrong.
From doc:
"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."
----
Server IP: 46.22.129.76
Probable Submitter: 89.204.223.15
----
Manual Page -- http://php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/115819
Del: integrated -- https://master.php.net/note/delete/115819/integrated
Del: useless -- https://master.php.net/note/delete/115819/useless
Del: bad code -- https://master.php.net/note/delete/115819/bad+code
Del: spam -- https://master.php.net/note/delete/115819/spam
Del: non-english -- https://master.php.net/note/delete/115819/non-english
Del: in docs -- https://master.php.net/note/delete/115819/in+docs
Del: other reasons-- https://master.php.net/note/delete/115819
Reject -- https://master.php.net/note/reject/115819
Search -- https://master.php.net/manage/user-notes.php