|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2018-10-29 12:20 UTC] cmb@php.net
 
-Status: Open
+Status: Verified
  [2018-10-29 12:20 UTC] cmb@php.net
  [2018-12-10 16:51 UTC] ab@php.net
  [2021-07-07 14:01 UTC] cmb@php.net
 
-Status:      Verified
+Status:      Wont fix
-Assigned To:
+Assigned To: cmb
  [2021-07-07 14:01 UTC] cmb@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 00:00:01 2025 UTC | 
Description: ------------ On Windows, if directory is opened by dir() or opendir(), but not closed, then call to rmdir() on that directory returns TRUE, but then there is few inconsistencies exist: - Second call to rmdir() on same directory fails (Permission denied) - You cannot delete parent directory (Directory not empty) - glob() doesn't see directory, but scandir() still sees it as existing. Test script: --------------- mkdir('testdir'); mkdir('testdir/sub'); $d = dir('testdir/sub'); while (false !== ($entry = $d->read())) { //echo $entry . "\n"; } //$d->close(); printf("rmdir=%d\n", rmdir('testdir/sub')); printf("glob=[%s]\n", implode(', ', glob('testdir/*'))); printf("scandir=[%s]\n", implode(', ', scandir('testdir'))); Expected result: ---------------- rmdir() should really succeed deleting folder and any further operations should work as with not existing one. rmdir=1 glob=[] scandir=[., ..] Deleting parent directory succeeds or rmdir() should fail with "Permission denied" on first try and any further operations should work as with still existing one. rmdir=0 glob=[testdir/sub] scandir=[., .., sub] Deleting parent directory fails Actual result: -------------- rmdir=1 glob=[] on PHP 7.0-7.2 glob=[testdir/sub] on PHP 5.6 scandir=[., .., sub]