|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-03-13 12:10 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Assigned To:
+Assigned To: cmb
[2021-03-13 12:10 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 20:00:01 2025 UTC |
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