Bug #80860 [NEW]: Every ((65535*n)-1)th element in glob() and DirectoryIterator() appears twice
From: andrey dot budko at gmail dot com
Operating system: win7, win10
PHP version: 7.4.16
Package: *Directory/Filesystem functions
Bug Type: Bug
Bug description:Every ((65535*n)-1)th element in glob() and DirectoryIterator() appears twice
Description:
------------
Every ((65535*n)-1)th element in glob() and DirectoryIterator() appears
twice.
Values of glob() array are not unique.
Test script:
---------------
<?php
function foo($tmp_dir, $count){
for($i = 1; $i <= $count; $i++){
@mkdir($tmp_dir.'/'.$i, 0777, true);
}
$count_glob = count(glob($tmp_dir.'/*'), GLOB_ONLYDIR);
$count_dir_iterator = 0;
$dir = new \DirectoryIterator($tmp_dir);
foreach($dir as $fileInfo){
if($fileInfo->isDir() && !$fileInfo->isDot()){
$count_dir_iterator++;
}
}
return [$count_glob, $count_dir_iterator];
}
echo foo('d:/test', 65533)."\n"; // 65533
echo foo('d:/test', 65534)."\n"; // 65535
echo foo('d:/test', 131068)."\n"; // 131069
echo foo('d:/test', 131069)."\n"; // 131071
--
Edit bug report at https://bugs.php.net/bug.php?id=80860&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80860&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80860&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80860&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80860&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80860&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80860&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80860&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80860&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80860&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80860&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80860&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80860&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80860&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80860&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80860&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80860&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80860&r=mysqlcfg
Thread (2 messages)
- andrey dot budko at gmail dot com