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

From: Date: Sun, 22 Apr 2018 07:46:24 +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-214832@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:         spam2 at rhsoft dot net
 Reported by:        losd at mail dot dk
 Summary:            opendir() fails on Windows directories with parent
                     directory unaccessible
 Status:             Open
 Type:               Bug
 Package:            Directory function related
 Operating System:   win32 only - Windows Server 2003
 PHP Version:        5.3.0beta1
 Block user comment: N
 Private report:     N

 New Comment:

outside the windows world this is normal behavior and php aims to behave as identical as possible on
every platform 

it's bad allow access deep in the tree just because somewhere are permissions wrong and in case
of a script running on a web server say thank you for the increased security, either the access was
not intended or set proper permissions


Previous Comments:
------------------------------------------------------------------------
[2018-04-22 01:38:56] rujjinjakka at rocketmail dot com

Same problem with PHP 7.1.1 with Windows NT build 7601 (Windows 7 Ultimate Edition Service Pack 1)
i586

It looks like chmod does not work either. I noticed that IIS does not have direct permission to
access the file. Maybe to have access to the file, the direct editing is necessary. I used the Chmod
( chmod 777 ) for the file, but it was only applied in the directory, not being applicable to the
files inside that directory.
In my case, it was a case of file import by form  (move_uploaded_file($tmp_name, $prev)). 

$prev =  $dir. "/" .basename( $filename );
if(move_uploaded_file($tmp_name, $prev)){
    echo "Success!". $prev
}

The file is copied but is not displayed in previews. The file does not have the permissions for the
IIS_IUSRS user.

------------------------------------------------------------------------
[2018-04-22 01:38:51] rujjinjakka at rocketmail dot com

Same problem with PHP 7.1.1 with Windows NT build 7601 (Windows 7 Ultimate Edition Service Pack 1)
i586

It looks like chmod does not work either. I noticed that IIS does not have direct permission to
access the file. Maybe to have access to the file, the direct editing is necessary. I used the Chmod
( chmod 777 ) for the file, but it was only applied in the directory, not being applicable to the
files inside that directory.
In my case, it was a case of file import by form  (move_uploaded_file($tmp_name, $prev)). 

$prev =  $dir. "/" .basename( $filename );
if(move_uploaded_file($tmp_name, $prev)){
    echo "Success!". $prev
}

The file is copied but is not displayed in previews. The file does not have the permissions for the
IIS_IUSRS user.

------------------------------------------------------------------------
[2016-12-28 04:02:12] kthprog at gmail dot com

I have the same problems. PHP 7.1 NTS on IIS ...10? Running Windows 10. The workaround appending a
subdir + .. worked for me.

------------------------------------------------------------------------
[2016-11-08 11:03:24] knagis at miga dot lv

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)

------------------------------------------------------------------------
[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:/.

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


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 (#214832) next »