ID: 45346
Updated by: [EMAIL PROTECTED]
Reported By: xavier dot pinard at laposte dot net
-Status: Open
+Status: Feedback
Bug Type: Arrays related
Operating System: WIN XP
PHP Version: 5.2.6
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2008-06-24 10:30:06] xavier dot pinard at laposte dot net
Description:
------------
object numeric's name properties are cast in string array's index.
created indexes becomes not accessible.
Reproduce code:
---------------
#5.2.7.-DEV on 2007-06-24
# WANTED => cast object to array and access first element with 0 index
#RESULT => the array key with the index '0' is nor accessible by 0 or
"0", uncool ...
#¿PROBLEM? => Shouldn't the array key needs to be numeric instead of a
string after object to array cast ?
$stdclass = neW StdcLaSs() ;
$stdclass->{0} = 'index0' ;
$stdclassElement = (arRaY)$stdclass ;
$var = array_keys( $stdclassElement ) ;
$key = $var [ 0 ] ;
Echo
'$stdclassElement[ $key ] :: ' , $stdclassElement[ $key ] ,
'$stdclassElement[0] :: ' , $stdclassElement[ 0 ] ,
'$stdclassElement["0"] :: ', $stdclassElement['0']
;
Expected result:
----------------
acess neither to array index '0' by [0] or ["0"]
Actual result:
--------------
the index is not accessible
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45346&edit=1