ID: 43817
User updated by: losd at mail dot dk
Reported By: losd at mail dot dk
Status: Open
Bug Type: Directory function related
Operating System: Windows Server 2003
PHP Version: 5.2.5
New Comment:
Temporary workaround found, but only if there is a known subdirectory
inside the top accessible directory:
opendir("C:/Test/NoAccess/Access/Subdir/..");
Previous Comments:
------------------------------------------------------------------------
[2008-01-11 12:23:54] losd at mail dot dk
Description:
------------
If the parent directory of a Windows network share is not accessible,
you are still able to access subdirectories if given explicit
permission.
However, PHP has trouble with the first accessible directory below an
inaccessible directory. This is not a problem for the accessible dir's
subdirs, though.
Scenario:
C:/Test/NoAccess/ -- Not accessible
Access/ -- Accesible from here
yyyyyyy.txt
Subdir/
xxxxxxx.txt
The problem has been found with opendir(), is_dir() and is_readable().
All directory functions are probably affected.
No workarounds has been found so far (suggestions appreciated).
Reproduce code:
---------------
<?php
if ($handle = opendir("C:/Test/NoAccess/Access/Subdir")) {
echo "Opened dir C:/Test/NoAccess/Access/Subdir<br/>";
while (false !== ($file = readdir($handle)))
echo"File: $file<br/>";
closedir($handle);
} else {
echo "Hmmmm, can't open directory, is it accessible?<br/>";
}
echo "<br/>";
if ($handle = opendir("C:/Test/NoAccess/Access")) {
echo "Opened directory C:/Test/NoAccess/Access<br/>";
while (false !== ($file = readdir($handle)))
echo"File: $file<br/>";
closedir($handle);
} else {
echo "Hmmmm, can't open directory, is it accessible?<br/>";
}
?>
Expected result:
----------------
Opened dir C:/Test/NoAccess/Access/Subdir
File: .
File: ..
File: xxxxxxx.txt
Opened dir C:/Test/NoAccess/Access
File: .
File: ..
File: yyyyyyy.txt
File: Subdir
Actual result:
--------------
Opened dir C:/Test/NoAccess/Access/Subdir
File: .
File: ..
File: xxxxxxx.txt
Warning: opendir(C:/Test/NoAccess/Access) [function.opendir]: failed to
open dir: No such file or directory in
C:\Inetpub\wwwroot\pm2\opendir.php on line 13
Hmmmm, can't open directory, is it accessible?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43817&edit=1