ID: 41678 User updated by: killgec at gmail dot com Reported By: killgec at gmail dot com Status: Bogus Bug Type: SPL related Operating System: * PHP Version: 5.2.3 New Comment:
Thanks. Then I think docs should be corrected: "when the ArrayObject refers to an object then this method returns an array of the public properties." http://www.php.net/~helly/php/ext/spl/classArrayObject.html#0215024a956996b2ddec156e0d7d544a Previous Comments: ------------------------------------------------------------------------ [2007-06-15 21:15:24] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php These strange chars are actually zero's. And that is simply the way PHP encodes public and protected member variables. ------------------------------------------------------------------------ [2007-06-13 12:10:31] killgec at gmail dot com Description: ------------ ArrayObject::getArrayCopy() returns not only public properties of an object, but private and protected properties, too. These last two have strange "inner-style" keys with illegal characters. Documentation says that ArrayObject::getArrayCopy() returns array created of public properties: http://www.php.net/~helly/php/ext/spl/classArrayObject.html Reproduce code: --------------- class A { public $a = 1; protected $b = 2; private $c = 3; } $a = new A(); $ao = new ArrayObject($a); print_R($ao->getArrayCopy()); var_dump((array)$ao); Expected result: ---------------- Array ( [a] => 1 ) array(3) { ["a"]=> int(1) } Actual result: -------------- Array ( [a] => 1 [< 1 illegal character here>*< 1 illegal character here>b] => 2 [< 1 illegal character here>A< 1 illegal character here>c] => 3 ) array(3) { ["a"]=> int(1) ["< 1 illegal character here>*< 1 illegal character here>b"]=> int(2) ["< 1 illegal character here>A< 1 illegal character here>c"]=> int(3) } literally: Array ( [a] => 1 [�*�b] => 2 [�A�c] => 3 ) array(3) { ["a"]=> int(1) ["�*�b"]=> int(2) ["�A�c"]=> int(3) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41678&edit=1