From:             xavier dot pinard at laposte dot net
Operating system: WIN XP
PHP version:      5.2.6
PHP Bug Type:     Arrays related
Bug description:  object to array cast indexing error

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 bug report at http://bugs.php.net/?id=45346&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45346&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45346&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45346&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45346&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45346&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45346&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45346&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45346&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45346&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45346&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45346&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45346&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45346&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45346&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45346&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45346&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45346&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45346&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45346&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45346&r=mysqlcfg

Reply via email to