[PHP-BUG] Bug #74358 [NEW]: FilesystemIterator repeats file entry at 65535, 65535*2 etc positions
[email protected] ("xtpd17 at gmail dot com")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
From: xtpd17 at gmail dot com
Operating system: Windows 7
PHP version: 5.6.30
Package: SPL related
Bug Type: Bug
Bug description:FilesystemIterator repeats file entry at 65535, 65535*2 etc positions
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>";
}
--
Edit bug report at https://bugs.php.net/bug.php?id=74358&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74358&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74358&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74358&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74358&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74358&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74358&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74358&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74358&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74358&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74358&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74358&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74358&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74358&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74358&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74358&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74358&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74358&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74358&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74358&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74358&r=mysqlcfg