|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49607 CachingIterator & DirectoryIterator incorrect behaviour
Submitted: 2009-09-20 14:18 UTC Modified: 2014-07-03 21:39 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: david at grudl dot com Assigned:
Status: Re-Opened Package: SPL related
PHP Version: 5.3.0 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david at grudl dot com
New email:
PHP Version: OS:


 [2009-09-20 14:18 UTC] david at grudl dot com
Iteration over CachingIterator with DirectoryIterator leads to incorrect results.

Reproduce code:
// w/o CachingIterator
$dir = new DirectoryIterator(dirname(__FILE__));
foreach ($dir as $val) {
	echo $val;

// with CachingIterator
$iterator = new CachingIterator($dir);
foreach ($iterator as $val) {
	echo $val;

Expected result:
It is expected the both code snippets produces the same result:


Actual result:
// w/o CachingIterator:

// with CachingIterator:
(empty string)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-30 20:07 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #49608
 [2009-12-01 13:17 UTC] david at grudl dot com
Please open this bug, it is something different to 49608. This bug is 
not about crash, it is about incorrect iteration results.
 [2014-07-03 21:39 UTC]
-Status: Not a bug +Status: Re-Opened
 [2014-07-03 21:39 UTC]
This is still not fixed.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Jul 20 21:01:24 2018 UTC