|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-03-11 12:06 UTC] salathe@php.net
-Status: Open
+Status: Not a bug
[2013-03-11 12:06 UTC] salathe@php.net
[2013-03-11 12:46 UTC] namarpi at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
Description: ------------ After using RecursiveIteratorIterator::getInnerIterator method in a loop, there is a missing RecursiveArrayIterator object in the result. For comparison, RecursiveIteratorIterator::getSubIterator method returns the expected result also. Test script: --------------- $array = array ( 'question' => 'text', 'items' => array ( '0' => array ( 'phrase' => 'text text', ), '1' => array ( 'phrase' => 'text text text', ), ), ); $array_object = new ArrayObject( $array, 0, "RecursiveArrayIterator" ); $iterator = new RecursiveIteratorIterator( $array_object->getIterator() ); foreach( $iterator as $key => $value ) { print_r( $iterator->getInnerIterator() ); // missing RecursiveArrayIterator Object of "items" } while( $iterator->valid() ) { print_r( $iterator->getInnerIterator() ); // missing RecursiveArrayIterator Object of "items" $iterator->next(); } foreach( $iterator as $key => $value ) { for( $i = 0; $i <= $iterator->getDepth(); $i++ ) { print_r( $iterator->getSubIterator($i) ); // correct } } Expected result: ---------------- The getInnerIterator method should return this object too: [11-Mar-2013 10:37:04 UTC] RecursiveArrayIterator Object ( [storage:ArrayIterator:private] => Array ( [0] => Array ( [phrase] => text text ) [1] => Array ( [phrase] => text text text ) ) ) Actual result: -------------- Missing the Expected result.