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
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: xtpd17 at gmail dot com
New email:
PHP Version: OS:

 

 [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: Thu Apr 18 08:02:42 2024 UTC