|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64714 ext/standard/tests/file/bug24482.phpt finds too many files if run too fast
Submitted: 2013-04-25 18:32 UTC Modified: 2013-04-27 12:18 UTC
From: Assigned: ab (profile)
Status: Closed Package: Testing related
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
 [2013-04-25 18:32 UTC]
ext/standard/tests/file/bug24482.phpt, run fast enough with other tests, on 4+ cpu core machines may get a different count of the files in the ext/standard/tests/file directory from glob() and opendir().

This is not a stat cache problem. Its just that other PHPT tests create files in ext/standard/tests/file directory and, though they clean them up, on very fast Windows servers, sometimes the deletion is committed to the file system (by Windows) during the time between the glob() and opendir() calls.

This isn't really a PHP problem, but rather an OS behavior/side-effect of performance optimizations in the OS/file-system.

The simple solution is to change the directory the test checks to ext/standard/tests. PHPT tests don't create test files there at all, so the count of files/directories there won't change during a test run.

Test script:
See ext/standard/tests/file/bug24482.phpt

Expected result:

Actual result:
Fail (2 different counts)


bug24482.patch.txt (last revision 2013-04-25 18:47 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-25 18:47 UTC]
The following patch has been added/updated:

Patch Name: bug24482.patch.txt
Revision:   1366915651
 [2013-04-25 18:48 UTC]
Bug affects 5.3, 5.4, 5.5 on Windows.

Attached patch fixes it on Windows and doesn't break on Linux.
 [2013-04-27 12:18 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2013-04-27 12:18 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

Fixed in bf5506f511e66a2b827988d611ccda4d75abc44e
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jun 23 09:01:24 2021 UTC