#48560 [Com]: E_STRICT does not report error if booleans or ints are used as arrays
ID: 48560
Comment by: niczak at gmail dot com
Reported By: mk at gigacodes dot de
Status: Verified
Bug Type: Variables related
Operating System: linux
PHP Version: 5.3CVS-2009-06-18 (CVS)
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/?id=48560&edit=1
Thread (5 messages)