From: namarpi at yahoo dot com
Operating system: Windows XP
PHP version: 5.4.13
Package: SPL related
Bug Type: Bug
Bug description:SPL RecursiveIteratorIterator::getChildren Uncaught exception
Description:
------------
Recently I am working with SPL Iterators, and got an uncaught exception
with the Test script.
Test script:
---------------
function example() {
$array = array (
'a' => array(
'a_1' => 'a 1 text',
),
);
$array_object = new ArrayObject( $array, 0, "RecursiveArrayIterator"
);
$iterator = new RecursiveIteratorIterator(
$array_object->getIterator(),
RecursiveIteratorIterator::SELF_FIRST );
foreach( $iterator as $key => $current ) {
var_dump( $iterator->getChildren );
var_dump( $iterator->getInnerIterator() );
//if( $key == 'a' ) {
var_dump( $iterator->getInnerIterator()->getChildren() );
//}
}
}
example();
Expected result:
----------------
Smooth iteration through the leaves.
Actual result:
--------------
[15-Mar-2013 09:29:55 UTC] PHP Fatal error: Uncaught exception
'InvalidArgumentException' with message 'Passed variable is not an array or
object, using empty array instead' in [...]
Stack trace:
#0 [internal function]: ArrayIterator->__construct('a 1 text', 67108864)
--
Edit bug report at https://bugs.php.net/bug.php?id=64428&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64428&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64428&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64428&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64428&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64428&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64428&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64428&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64428&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64428&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64428&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64428&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64428&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64428&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64428&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64428&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64428&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64428&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64428&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64428&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64428&r=mysqlcfg