php.net |  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: mattficken@php.net 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] mattficken@php.net
Description:
------------
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:
----------------
Pass

Actual result:
--------------
Fail (2 different counts)

Patches

bug24482.patch.txt (last revision 2013-04-25 18:47 UTC by mattficken@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

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

Patch Name: bug24482.patch.txt
Revision:   1366915651
URL:        https://bugs.php.net/patch-display.php?bug=64714&patch=bug24482.patch.txt&revision=1366915651
 [2013-04-25 18:48 UTC] mattficken@php.net
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] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2013-04-27 12:18 UTC] ab@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed in bf5506f511e66a2b827988d611ccda4d75abc44e
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 10 00:01:25 2020 UTC