|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42948 DirectoryIterator don't close handle
Submitted: 2007-10-12 12:59 UTC Modified: 2007-10-12 17:17 UTC
From: develar at gmail dot com Assigned:
Status: Closed Package: SPL related
PHP Version: 5.2.4 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: develar at gmail dot com
New email:
PHP Version: OS:


 [2007-10-12 12:59 UTC] develar at gmail dot com
I can't delete directory after use DirectoryIterator. I read

Reproduce code:

$root_dir_pathname = '/tmp/' . mt_rand();
$DirectoryIterator = new DirectoryIterator($root_dir_pathname);
foreach ($DirectoryIterator as $SplFileInfo)





Expected result:
no error

Actual result:
Warning: rmdir(/tmp/49058378) [function.rmdir]: Permission denied in C:\home\test\www\test.php on line 11


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-12 17:06 UTC]
Why are you mixing Unix and Windows paths and please try unsetting $SplFileInfo, too.
 [2007-10-12 17:17 UTC] develar at gmail dot com
Big thanks. I unset($SplFileInfo); and it works. It is a little difficult to guess, but it is logically correct. This is bogus, excuse me :)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 19 09:03:37 2021 UTC