Edit report at http://bugs.php.net/bug.php?id=48560&edit=1

 ID:                 48560
 Comment by:         bugs dot php dot net at moesen dot nu
 Reported by:        mk at gigacodes dot de
 Summary:            E_STRICT does not report error if booleans or ints
                     are used as arrays
 Status:             Verified
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   linux
 PHP Version:        5.*, 6
 Block user comment: N
 Private report:     N

 New Comment:

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"?


Previous Comments:
------------------------------------------------------------------------
[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] [email protected]

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/bug.php?id=48560&edit=1

Reply via email to