php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60399 IteratorAggregate and RecursiveIterator::getChildren()
Submitted: 2011-11-27 18:34 UTC Modified: -
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:0 (0.0%)
From: tklingenberg at lastflood dot net Assigned:
Status: Open Package: SPL related
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tklingenberg at lastflood dot net
New email:
PHP Version: OS:

 

 [2011-11-27 18:34 UTC] 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)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-10 13:01 UTC] powtac at gmx dot de
This bug seems related to this one: https://bugs.php.net/bug.php?id=68682
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 21:01:30 2024 UTC