Bug #48560 [Ver->Dup]: E_STRICT does not report error if booleans or ints are used as arrays
Edit report at https://bugs.php.net/bug.php?id=48560&edit=1
ID: 48560
Updated by: cmb@php.net
Reported by: mk at gigacodes dot de
Summary: E_STRICT does not report error if booleans or ints
are used as arrays
-Status: Verified
+Status: Duplicate
Type: Bug
Package: Scripting Engine problem
Operating System: linux
PHP Version: 5.*, 6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Indeed, that is a duplicate of bug #37676, and the same issue has been reported several times since
this report (requinix has gathered some of these in bug #65484).
Previous Comments:
------------------------------------------------------------------------
[2011-01-27 15:03:03] bugs dot php dot net at moesen dot nu
Same behaviour on Mac OS X, "PHP 5.3.5 (cli) (built: Jan 24 2011 12:53:02)":
PHP Notice: Undefined variable: xxx in Command line code on line 4
PHP Notice: Undefined offset: 1 in Command line code on line 12
Isn't this a dupe of "bug #37676 â using Array access operator [] on boolean variable
does not show Notice"?
------------------------------------------------------------------------
[2009-07-06 18:55:49] niczak at gmail dot com
After performing the same tests in the original post I get the same results. Only 2 errors reported
as opposed to the expected 3. PHP Version 5.2.8 on a Solaris box.
------------------------------------------------------------------------
[2009-06-18 14:59:30] gwynne@php.net
Verified on Darwin9 with 5.3CVS-2009-06-18
------------------------------------------------------------------------
[2009-06-15 15:20:23] mk at gigacodes dot de
Description:
------------
when setting error_reporting to E_ALL|E_STRICT accessing undefined offsets in array $arr is
reported. However if $arr is a boolean, int or null there is no error reported
Reproduce code:
---------------
<?
error_reporting(E_ALL | E_NOTICE | E_STRICT);
#reports undefined variable
echo $xxx;
#does not report error
$xxx = false;
echo $xxx[1];
#reports undefinied offset
$xxx = array();
echo $xxx[1];
?>
Expected result:
----------------
I expect to see 3 errors
Actual result:
--------------
instead i see only 2:
Notice: Undefined variable: xxx
Notice: Undefined offset: 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=48560&edit=1
Thread (5 messages)