#44615 [Asn->Csd]: RecursiveArrayIterator doesnt handle correctly objects stored in it
| From: | colder@php.net | Date: | Tue, 06 May 2008 23:15:19 +0000 |
| Subject: | #44615 [Asn->Csd]: RecursiveArrayIterator doesnt handle correctly objects stored in it | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124770@lists.php.net to get a copy of this message | ||
ID: 44615
Updated by: colder@php.net
Reported By: doctorrock83 at gmail dot com
-Status: Assigned
+Status: Closed
Bug Type: SPL related
Operating System: Windows XP
PHP Version: 6-CVS
Assigned To: colder
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
This feature is now controlled by the flag
RecursiveArrayIterator::CHILD_ARRAYS_ONLY which is no longer enabled by
default.
Previous Comments:
------------------------------------------------------------------------
[2008-04-02 23:12:44] felipe@php.net
Sorry, it works fine on 5.3, fails on 5.2.6 and HEAD.
This is probably related to bug #38618, and looks that wasn't defined
the fix/behavior, right Marcus? Hence, it wasn't merged into branches.
Assigned to maintainer.
------------------------------------------------------------------------
[2008-04-02 22:05:36] felipe@php.net
I can reproduce using PHP6-CVS.
------------------------------------------------------------------------
[2008-04-02 21:54:54] felipe@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
Works fine on 5.2.6.
------------------------------------------------------------------------
[2008-04-02 15:36:37] doctorrock83 at gmail dot com
Description:
------------
RecursiveArrayIterator doesn't seem to handle objects stored in it
correctly.
If you store anything else into the RecursiveArrayIterator (ie :
strings, integers, or even ressources ), they are served back from the
iterator.
But if you store an object of any class into it, then it disappears
while iterating.
PS : Perhaps a RecursiveIteratorIterator bug, dunnow :-)
Reproduce code:
---------------
<?php
$a = new stdClass();
$array = array(array('z',$a),array('q','s'));
$rai = new RecursiveArrayIterator($array);
foreach (new RecursiveIteratorIterator($rai) as $t) {
var_dump($t);
}
Expected result:
----------------
string(1) "z"
object(stdClass)#1 (0) {
}
string(1) "q"
string(1) "s"
Actual result:
--------------
string(1) "z"
string(1) "q"
string(1) "s"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44615&edit=1