ID: 49154
Updated by: [email protected]
Reported By: william dot bailey at cowboysfromhell dot co dot uk
-Status: Open
+Status: Closed
Bug Type: Reflection related
PHP Version: 5.3.0
New Comment:
Already fixed in svn. And it will only return 2 properties. '56' is not
valid property name.
Previous Comments:
------------------------------------------------------------------------
[2009-08-04 14:45:25] william dot bailey at cowboysfromhell dot co dot
uk
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 this bug report at http://bugs.php.net/?id=49154&edit=1