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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Tue Apr 23 10:01:29 2024 UTC