From: losd at mail dot dk Operating system: Windows Server 2003 PHP version: 5.2.5 PHP Bug Type: Directory function related Bug description: opendir() fails on Windows directories with parent directory unaccessible
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 bug report at http://bugs.php.net/?id=43817&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43817&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43817&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43817&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43817&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43817&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43817&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43817&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43817&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43817&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43817&r=support Expected behavior: http://bugs.php.net/fix.php?id=43817&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43817&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43817&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43817&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43817&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43817&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43817&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43817&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43817&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43817&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43817&r=mysqlcfg