Edit report at http://bugs.php.net/bug.php?id=50613&edit=1
ID: 50613
Comment by:
Reported by: felix at amerimerchant dot com
Summary: Expected warnings/notices not outputed by PHP on
simple array access.
Status: No Feedback
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.1
New Comment:
Is there any further step we need to perform to get this out of the "No
Feedback" status? Felix's 2010-01-02 00:08 UTC comment answered Jani's
question, but we did not see any option for updating the bug status out
of the feedback stage ourselves. Is there a manual status change
required by Jani, or did we miss an option on the bug reporting form?
Previous Comments:
------------------------------------------------------------------------
[2010-01-07 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2010-01-02 02:08:41] felix at amerimerchant dot com
Same behavior using the most recent build I just tried:
C:\php5.3.3-dev>php.exe -v
PHP 5.3.3-dev (cli) (built: Jan 2 2010 01:06:43)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
C:\php5.3.3-dev>php.exe "C:\Documents and
Settings\Administrator\Desktop\test.php"
Notice: Uninitialized string offset: 9 in C:\Documents and
Settings\Administrator\Desktop
test.php on line 6
Notice: Undefined offset: 9 in C:\Documents and
Settings\Administrator\Desktop\test.php o
line 9
Fatal error: Cannot use object of type stdClass as array in C:\Documents
and Settings\Adm
nistrator\Desktop\test.php on line 24
C:\php5.3.3-dev>
------------------------------------------------------------------------
[2009-12-30 23:47:50] [email protected]
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-12-30 20:55:02] felix at amerimerchant dot com
Description:
------------
When accessing a variable containing a boolean, integer, floating point,
or null value using square bracket syntax, no warning or notice is
generated (even if the array index could not exist if the type was
silently juggled into a string or array). This occurs even with E_STRICT
turned on.
Reproduce code:
---------------
<?php
error_reporting( -1 );
$x = "string";
print( $x[9] );
$x = array(1, 2, 3);
print( $x[9] );
$x = false;
print( $x[9] );
$x = 3;
print( $x[9] );
$x = 3.01;
print( $x[9] );
$x = null;
print( $x[9] );
$x = new StdClass();
print( $x[9] );
?>
Expected result:
----------------
PHP Notice: Uninitialized string offset: 9 in /tmp/test.php on line 6
PHP Notice: Undefined offset: 9 in /tmp/test.php on line 9
[A notice or warning for line 12]
[A notice or warning for line 15]
[A notice or warning for line 18]
[A notice or warning for line 21]
PHP Fatal error: Cannot use object of type stdClass as array in
/tmp/test.php on line 24
Actual result:
--------------
PHP Notice: Uninitialized string offset: 9 in /tmp/test.php on line 6
PHP Notice: Undefined offset: 9 in /tmp/test.php on line 9
PHP Fatal error: Cannot use object of type stdClass as array in
/tmp/test.php on line 24
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=50613&edit=1