php.net |  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
2 + 23 = ?
Subscribe to this entry?

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

...
65533.txt
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...
65535.txt 
65536.txt 
...


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"

2) 
$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);
	$n++;
	if ($name == $name_prev)
		echo "DUPILCATE ENTRY FOUND AT $n: $name <br>";
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-01 10:59 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2017-04-01 10:59 UTC] requinix@php.net
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] bwoebi@php.net
-Status: Feedback +Status: Wont fix
 [2017-04-01 13:57 UTC] bwoebi@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 06:01:30 2024 UTC