#38618 [NoF->Opn]: default implementation of hasChildren() in RecursiveArrayIterator does not work
| From: | mike at silverorange dot com | Date: | Thu, 28 Jun 2007 01:50:26 +0000 |
| Subject: | #38618 [NoF->Opn]: default implementation of hasChildren() in RecursiveArrayIterator does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-114366@lists.php.net to get a copy of this message | ||
ID: 38618
User updated by: mike at silverorange dot com
Reported By: mike at silverorange dot com
-Status: No Feedback
+Status: Open
Bug Type: SPL related
Operating System: Linux
PHP Version: 5.1.5
New Comment:
reopening
Previous Comments:
------------------------------------------------------------------------
[2006-09-05 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-08-28 10:47:52] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[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