From:             william dot bailey at cowboysfromhell dot co dot uk
Operating system: 
PHP version:      5.3.0
PHP Bug Type:     Reflection related
Bug description:  Corrupted reflection information when object property is 
numeric

Description:
------------
Reflection information returned by ReflectionObject::getProperties() is
corrupt when an object has numeric properties.

Reproduce code:
---------------
<?php
function d($o)
{
    print get_class($o).PHP_EOL.PHP_EOL;
    $r = new ReflectionObject($o);
    foreach($r->getProperties() as $p)
    {
        var_dump($p);
        print 'Name (HEX): '. bin2hex($p->getName()).PHP_EOL;
        print PHP_EOL.PHP_EOL;
    }
}

d((object) array('foo'=>'zero', '56'=>'one', 'bar'=>'two'));


Expected result:
----------------
stdClass

object(ReflectionProperty)#3 (2) {
  ["name"]=>
  string(3) "foo"
  ["class"]=>
  string(8) "stdClass"
}
Name (HEX): 666f6f


object(ReflectionProperty)#4 (2) {
  ["name"]=>
  string(2) "56"
  ["class"]=>
  string(8) "stdClass"
}
Name (HEX): 3536


object(ReflectionProperty)#5 (2) {
  ["name"]=>
  string(3) "bar"
  ["class"]=>
  string(8) "stdClass"
}
Name (HEX): 626172


Actual result:
--------------
stdClass

object(ReflectionProperty)#3 (2) {
  ["name"]=>
  string(3) "foo"
  ["class"]=>
  string(8) "stdClass"
}
Name (HEX): 666f6f


object(ReflectionProperty)#4 (2) {
  ["name"]=>
  string(9) "rties() !"
  ["class"]=>
  string(8) "stdClass"
}
Name (HEX): 727469657328292021


object(ReflectionProperty)#5 (2) {
  ["name"]=>
  string(3) "bar"
  ["class"]=>
  string(8) "stdClass"
}
Name (HEX): 626172


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

Reply via email to