Bug #43817 [Com]: opendir() fails on Windows directories with parent directory unaccessible

From: Date: Tue, 08 Nov 2016 11:03:31 +0000
Subject: Bug #43817 [Com]: opendir() fails on Windows directories with parent directory unaccessible
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205237@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=43817&edit=1

 ID:                 43817
 Comment by:         knagis at miga dot lv
 Reported by:        losd at mail dot dk
 Summary:            opendir() fails on Windows directories with parent
                     directory unaccessible
 Status:             Assigned
 Type:               Bug
 Package:            Directory function related
 Operating System:   win32 only - Windows Server 2003
 PHP Version:        5.3.0beta1
 Assigned To:        pajoye
 Block user comment: N
 Private report:     N

 New Comment:

I have the same problem on Windows Server 2012 R2 and both PHP 5.6.24 and PHP 7.0.9. In my case the
DirectoryIterator::__construct was failing with Access is denied. (code: 5)


Previous Comments:
------------------------------------------------------------------------
[2015-01-22 19:13:44] scott at phphq dot net

This bug still exists in php 5.4.36. win32 - Windows Server 2003, iis6. I can readfile, chdir but if
I try to read the files (scandir, opendir, DirectoryIterator) I get an access denied error.

C:/Website/ -- Not accessible
C:/Website/public_html  -- Accessible
C:/Website/public_html/etc...  -- Accessible

User has correct permission to C:/Website but no permissions for access on C:/.

------------------------------------------------------------------------
[2013-03-05 12:12:50] pajoye@php.net

@mindless at mindless999 dot net

That's correct, I forgot to add this info to this bug report (present in another 
one). It is required to allow the underlying Windows API to get through the 
directories while it won't allow the user to access it.

------------------------------------------------------------------------
[2013-03-05 12:08:05] mindless at mindless999 dot net

Issue still exists in 5.3.22

Workaround is to give the user under which the website is running (advanced) "list folder /
read data" permissions on the parent folder.
this is the only permission required.

------------------------------------------------------------------------
[2013-01-16 09:20:16] pajoye@php.net

It does matter. The reasons are:

1. Windows support case sensitive filesystems (in any modern versions)
2. the real path stat cache is case sensitive, for portability and performance, 
by design.

However, no matter how the case is, you have to set the attributes permissions. 
If it is not allowed to read the attributes, php won't be able to load that file 
or path. And again, it has absolutely nothing do with case sensitive paths.

Last but not least, if you see the bug status, it is still open as a bug, but it 
is about other issues caused by FindFirstFile, not the case sensitivity.

------------------------------------------------------------------------
[2013-01-16 06:42:04] d at hp23c dot dk

In Windows, it _does not matter_ if it is C:\fOo or c:\foo. If you do not lowercase (or uppercase,
or whatever) to compare, it is a bug.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=43817


--
Edit this bug report at https://bugs.php.net/bug.php?id=43817&edit=1


Thread (35 messages)

« previous php.bugs (#205237) next »