Req #60399 [Com]: IteratorAggregate and RecursiveIterator::getChildren()
Edit report at https://bugs.php.net/bug.php?id=60399&edit=1
ID: 60399
Comment by: powtac at gmx dot de
Reported by: tklingenberg at lastflood dot net
Summary: IteratorAggregate and
RecursiveIterator::getChildren()
Status: Open
Type: Feature/Change Request
Package: SPL related
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
This bug seems related to this one: https://bugs.php.net/bug.php?id=68682
Previous Comments:
------------------------------------------------------------------------
[2011-11-27 18:34:45] tklingenberg at lastflood dot net
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 this bug report at https://bugs.php.net/bug.php?id=60399&edit=1
Thread (2 messages)