Req #37676 [Com]: using Array access operator [] on boolean variable does not show Notice
| From: | svodev at gmail dot com | Date: | Sat, 29 Sep 2012 12:20:33 +0000 |
| Subject: | Req #37676 [Com]: using Array access operator [] on boolean variable does not show Notice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-173803@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=37676&edit=1
ID: 37676
Comment by: svodev at gmail dot com
Reported by: tgross at m-s dot de
Summary: using Array access operator [] on boolean variable
does not show Notice
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: *
PHP Version: *
Block user comment: N
Private report: N
New Comment:
The same issue is with NULL values;
$a = NULL;
echo $a['b'];
...and nothing happen
Previous Comments:
------------------------------------------------------------------------
[2006-06-02 11:25:00] tony2001@php.net
Reclassified as feature request.
------------------------------------------------------------------------
[2006-06-02 11:21:51] tgross at m-s dot de
Description:
------------
When trying to access an array using an undefined offset, PHP displays an Notice.
However, when you access a boolean variable with any combination of the array operator [], PHP just
returns NULL and displays no error message.
Reproduce code:
---------------
error_reporting (E_ALL);
$a = false;
var_dump ($a[5]);
var_dump ($a['test'][-3]);
Expected result:
----------------
PHP should display a Notice or a Warning.
Actual result:
--------------
PHP displays
NULL NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=37676&edit=1