|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79990 glob() returns duplicate values
Submitted: 2020-08-18 14:58 UTC Modified: 2020-08-18 15:19 UTC
From: bonzura at yahoo dot co dot jp Assigned: cmb (profile)
Status: Duplicate Package: Filesystem function related
PHP Version: 7.4.9 OS: Windows10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
1 + 15 = ?
Subscribe to this entry?

 [2020-08-18 14:58 UTC] bonzura at yahoo dot co dot jp
glob() returns duplicate values ​​when the number of files is 65534 or more.

It occurs only in Windows PHP ver 7.4.9 or earlier, not in 8.0 or Linux.

When number of files increase, duplicate values also increase.

When I tried Test script $max=1000000, result is below.
Duplicated test/0000065534.txt->2
Duplicated test/0000131069.txt->2
Duplicated test/0000196604.txt->2
Duplicated test/0000262139.txt->2
Duplicated test/0000327674.txt->2
Duplicated test/0000393209.txt->2
Duplicated test/0000458744.txt->2
Duplicated test/0000524279.txt->2
Duplicated test/0000589814.txt->2
Duplicated test/0000655349.txt->2
Duplicated test/0000720884.txt->2
Duplicated test/0000786419.txt->2
Duplicated test/0000851954.txt->2
Duplicated test/0000917489.txt->2
Duplicated test/0000983024.txt->2

Test script:
for ($i=1;$i<=$max;$i++){

echo count($files)."\n";

foreach ($check as $key=>$value){
	if ($value!=1){
		echo "Duplicated ".$key."->".$value."\n";

Expected result:

Actual result:
Duplicated test/0000065534.txt->2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-18 15:19 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2020-08-18 15:19 UTC]
This is a duplicate of bug #36365.  The fix for that bug cannot be
backported, because it breaks the ABI.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 08 05:03:37 2023 UTC