From: namarpi at yahoo dot com
Operating system: Windows XP
PHP version: 5.4.12
Package: SPL related
Bug Type: Bug
Bug description:missing iterator object with
RecursiveIteratorIterator::getInnerIterator
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.
--
Edit bug report at https://bugs.php.net/bug.php?id=64403&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64403&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64403&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64403&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64403&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64403&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64403&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64403&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64403&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64403&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64403&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64403&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64403&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64403&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64403&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64403&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64403&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64403&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64403&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64403&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64403&r=mysqlcfg