Edit report at https://bugs.php.net/bug.php?id=36365&edit=1

 ID:                 36365
 Comment by:         gobie at centrum dot cz
 Reported by:        pilhoon at gmail dot com
 Summary:            scandir duplicates file name at every 65535th file
 Status:             No Feedback
 Type:               Bug
 Package:            Directory function related
 Operating System:   windows
 PHP Version:        5.1.2
 Block user comment: N
 Private report:     N

 New Comment:

Same problem reproduced
PHP Version 5.4.4 Windows 7 x64
PHP Version 5.3.13 Windows 7 x32

But all PHP methods listing files are affected scandir, glob, DirectoryIterator.

Reproduce code:
---------------
// Settings
$dir = './test/';
$totalFiles = 1e5;

// Create empty files
!is_dir($dir) && mkdir($dir);
for ($i = 0; $i < $totalFiles; ++$i) {
    $filename = $dir . str_pad($i, 6, '0', STR_PAD_LEFT);
    touch($filename);
}

// Glob
$files = glob($dir . '*');
echo 'glob: ' . count($files) . '/' . $totalFiles . PHP_EOL;

// Scandir
$files = scandir($dir);
echo 'scandir: ' . (count($files) - 2) . '/' . $totalFiles . PHP_EOL; // . and 
..

// DirectoryIterator
$it = new DirectoryIterator($dir);
echo 'DirectoryIterator: ' . (iterator_count($it) - 2) . '/' . $totalFiles . 
PHP_EOL; // . and ..
unset($it);

Expected result:
----------------
glob: 100000/100000
scandir: 100000/100000
DirectoryIterator: 100000/100000

Actual result:
--------------
glob: 100001/100000
scandir: 100001/100000
DirectoryIterator: 100001/100000


Previous Comments:
------------------------------------------------------------------------
[2010-01-15 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2010-01-07 18:26:21] [email protected]

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------
[2010-01-07 18:02:51] enzo at smshome dot net

Same problem here using PHP Version 5.2.5 (x64) with Windows XP 64bit 
Professional Edition.

Duplicated files every 65535 files read using scandir(). I think you should put 
an alert on manual page:
http://php.net/manual/en/function.scandir.php

------------------------------------------------------------------------
[2006-02-19 01:00:04] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2006-02-11 13:21:34] [email protected]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip



------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=36365


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=36365&edit=1

Reply via email to