ID:               50613
 Updated by:       j...@php.net
 Reported By:      felix at amerimerchant dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: Linux
 PHP Version:      5.3.1
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[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/?id=50613&edit=1

Reply via email to