Bug #55468 [Com]: UnexpectedValueException caused by an unreleased handle or something
| From: | qing0088 at hotmail dot com | Date: | Mon, 29 Aug 2011 08:30:10 +0000 |
| Subject: | Bug #55468 [Com]: UnexpectedValueException caused by an unreleased handle or something | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-163082@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55468&edit=1
ID: 55468
Comment by: qing0088 at hotmail dot com
Reported by: php at tracking-celebs dot info
Summary: UnexpectedValueException caused by an unreleased
handle or something
Status: Open
Type: Bug
Package: SPL related
Operating System: win32
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
http://www.nflbengalssite.com/cincinnati-bengals-jerseys-andre-smith-jersey-c-9_13.html Andre
Smith Jersey Authentic
http://www.nflbengalssite.com/cincinnati-bengals-jerseys-andy-dalton-jersey-c-9_21.html Andy
Dalton Jersey Authentic
http://www.nflbengalssite.com/cincinnati-bengals-jerseys-bernard-scott-jersey-c-9_19.html Bernard
Scott Jersey Authentic
Previous Comments:
------------------------------------------------------------------------
[2011-08-25 00:06:26] php at tracking-celebs dot info
Permissions aren't a problem here.
Besides, the (first, $foo) folder actually gets removed (as indicated by the output of file_exists),
that's not the problem.
And the problem comes before trying to remove the other one ($folder), it is that when calling the
iterator (on that parent), because it'll somehow still "hold"/find a reference to the
now non-existing/freshly removed folder, thus causing the exception...
------------------------------------------------------------------------
[2011-08-22 13:58:59] kalle@php.net
At first glance it doesn't looks like a problem in PHP itself but more that you haven't
granted yourself the permission to delete the folder on Windows.
Have you tried to chmod or similar it?
------------------------------------------------------------------------
[2011-08-20 19:56:20] php at tracking-celebs dot info
Description:
------------
After using a DirectoryIterator on a folder, then removing said folder, using another iterator to
iterate on the folder's parent will see/try to look into the removed folder.
This only happens on Windows, so maybe due to a cache somewhere or something. Tried adding a
clearstatcache() just in case, but that doesn't change anything.
FYI if you replace the first DirectoryIterator by a:
opendir($foo);
without calling closedir() you get the same error, hence why I suggested it might be a handle not
(properly) released or something.
Test script:
---------------
<?php
$folder = 'V:\\tmp\\foobar';
if (file_exists($folder)) die("$folder already exists");
if (!mkdir($folder)) die("unable to create $folder");
$foo = $folder . '\\foo';
if (!mkdir($foo)) die("unable to create $foo");
$iterator = new DirectoryIterator($foo);
foreach ($iterator as $fi) { }
unset($iterator);
if (!rmdir($foo)) die("unable to delete $foo");
var_dump(file_exists($foo));
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder),
RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $fi) { }
unset($iterator);
if (!rmdir($folder)) die("unable to delete $folder");
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(false)
Fatal error: Uncaught exception 'UnexpectedValueException' with message
'RecursiveDirectoryIterator::__construct(V:\tmp\foobar\foo,V:\tmp\foobar\foo): Access is
denied. (code: 5)' in V:\test\test.php on line 35
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55468&edit=1