ID: 38618 Updated by: [EMAIL PROTECTED] Reported By: mike at silverorange dot com -Status: Open +Status: Feedback Bug Type: SPL related Operating System: Linux PHP Version: 5.2.3 New Comment:
I'm more interested in the reproduce case than in its output. Previous Comments: ------------------------------------------------------------------------ [2007-06-28 16:26:15] mike at silverorange dot com Try this URL: http://labs.silverorange.com/local/solabs/include/recursive-array-iterator.php ------------------------------------------------------------------------ [2007-06-28 06:05:37] [EMAIL PROTECTED] telnet wiki.silverorange.com 80 telnet: wiki.silverorange.com: Name or service not known wiki.silverorange.com: Unknown host ------------------------------------------------------------------------ [2007-06-28 01:51:27] mike at silverorange dot com This bug still exists in PHP 5.2.3 using the same test script as before. ------------------------------------------------------------------------ [2006-08-27 22:10:35] mike at silverorange dot com Description: ------------ The default implementation of hasChildren() in RecursiveArrayIterator does not work if the recursive array contains object references. If I subclass the RecursiveArrayIterator and re-implement the method exactly as it is in the source code everything is fine. If I use the default implementation, the objects in my array do not get iterated. Inside my re-implemented hasChildren() method if I call parent::hasChildren() it returns 1 when $this->current() is an object. Reproduce code: --------------- Code to reproduce: http://wiki.silverorange.com/Recursive_Array_Iterator Expected result: ---------------- Expected output from reproduce code: Default recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit Reimplemented hasChildren() recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit Default recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit Reimplemented hasChildren() recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit Actual result: -------------- Output from reproduce code: Default recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit Reimplemented hasChildren() recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit Default recursive array iteraration: Reimplemented hasChildren() recursive array iteraration: 1 => apple 2 => orange 3 => banana 1 => grape 2 => peach 3 => strawberry 4 => grapefruit ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38618&edit=1