|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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: Thu Dec 02 16:03:40 2021 UTC