|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74358 FilesystemIterator repeats file entry at 65535, 65535*2 etc positions
Submitted: 2017-04-01 10:25 UTC Modified: 2017-04-01 13:57 UTC
From: xtpd17 at gmail dot com Assigned:
Status: Wont fix Package: SPL related
PHP Version: 5.6.30 OS: Windows 7
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: xtpd17 at gmail dot com
New email:
PHP Version: OS:


 [2017-04-01 10:25 UTC] xtpd17 at gmail dot com
When FilesystemIterator iterates through folder with many files, it doubles file entries at 65535th and, more generally, 65535*n+(n-1) positions (131071,196607...).

65534.txt // ok
65534.txt // omg what happened with my file system, is it broken? But chkdsk shows nothing bad. Oh well, it's just iterator...

7.0.0 and later versions work fine.

Test script:
1) to generate many files in one folder use batch like
for /l %a in (1 1 200000) do type nul > "%a.txt"

$path = 'd:\pathtoyour\folder';
$items = new FilesystemIterator($path,FilesystemIterator::CURRENT_AS_PATHNAME);
$n = 0;
$name = '';
foreach ($items as $item)
	$name_prev = $name;
	$name = basename($item);
	if ($name == $name_prev)
		echo "DUPILCATE ENTRY FOUND AT $n: $name <br>";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-01 10:59 UTC]
-Status: Open +Status: Feedback
 [2017-04-01 10:59 UTC]
I can repro in 5.6 but not 7.0 or 7.1. Can you? 5.6 is no longer in active support so this wouldn't be fixed there.
 [2017-04-01 13:57 UTC]
-Status: Feedback +Status: Wont fix
 [2017-04-01 13:57 UTC]
He said "7.0.0 and later versions work fine."

So, marking as Won't fix for 5.6 as per the release process.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Dec 10 10:01:27 2023 UTC