ID:               43817
 Updated by:       [EMAIL PROTECTED]
 Reported By:      losd at mail dot dk
 Status:           Assigned
 Bug Type:         Directory function related
 Operating System: Windows Server 2003
 PHP Version:      5.2.5
 Assigned To:      dmitry
 New Comment:

I am experiencing this issue as well, but on local directories, not
network shares.  My OS is Windows XP Pro.  The opendir() functionality
works correctly in release 5.2.1.  The functionality is broken in
releases 5.2.2 through 5.2.5, plus the 526-php5.2-win32-200802292130 and
php5.3-win32-200802201330 snapshots.


Previous Comments:
------------------------------------------------------------------------

[2008-01-11 13:36:50] losd at mail dot dk

Temporary workaround found, but only if there is a known subdirectory
inside the top accessible directory:

opendir("C:/Test/NoAccess/Access/Subdir/..");

------------------------------------------------------------------------

[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

Reply via email to