|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
10 + 3 = ?
Subscribe to this entry?

 [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 17:03:35 2021 UTC