From: Operating system: PHP version: 5.3.8 Package: SPL related Bug Type: Feature/Change Request Bug description:IteratorAggregate and RecursiveIterator::getChildren()
Description: ------------ On the one hand it's possible to create a RecursiveIteratorIterator out of an object that implements IteratorAggregate *and* that returns an object implementing RecursiveIterator for IteratorAggregate::getIterator(). That's fine. On the other hand, if RecursiveIterator::getChildren() returns an object that implements IteratorAggregate *and* that returns an object implementing RecursiveIterator for IteratorAggregate::getIterator() it gives this error: Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator' It would be nice if both, the iterator object in instantiating RecursiveIteratorIterator and the return object for RecursiveIterator::getChildren() would be compatible in the sense that both would allow an object implementing IteratorAggregate. Right now, only the constructor allows this, but getChildren() does not allow IteratorAggregate. For completeness of this report, if an invalid iterator is given on instantiating a RecursiveIteratorIterator, the error message is: Fatal error: Uncaught exception 'InvalidArgumentException' with message 'An instance of RecursiveIterator or IteratorAggregate creating it is required' Test script: --------------- (my test script is a little larger, I can provide one upon request) -- Edit bug report at https://bugs.php.net/bug.php?id=60399&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60399&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60399&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60399&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60399&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60399&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60399&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60399&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60399&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60399&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60399&r=support Expected behavior: https://bugs.php.net/fix.php?id=60399&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60399&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60399&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60399&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60399&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60399&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60399&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60399&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60399&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60399&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60399&r=mysqlcfg