php.net |  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.
Password:
Status:
Package:
Bug Type:
Summary:
From: develar at gmail dot com
New email:
PHP Version: OS:

 

 [2007-10-12 12:59 UTC] develar at gmail dot com
Description:
------------
I can't delete directory after use DirectoryIterator. I read http://bugs.php.net/bug.php?id=35997

Reproduce code:
---------------
<?php

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

}

unset($DirectoryIterator);

rmdir($root_dir_pathname);

?>

Expected result:
----------------
no error

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-12 17:06 UTC] johannes@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC