Bug #43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
Edit report at https://bugs.php.net/bug.php?id=43817&edit=1 ID: 43817 Updated by: paj...@php.net 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: @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. Previous Comments: [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] paj...@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. [2013-01-14 11:26:46] paj...@php.net Ok, the actual issue is about setting the right permissions. It is possible to block read&write and other operations but the read of the attribute of a given path must be allowed. It is used by almost all file functions(Find*, GetLong/ShortPathName, etc.). Without the permissions allowing to read attributes, we won't be able to fetch the actual name (ie: c:\Foo is given but the actual name is c:\fOo). We used the actual to store it in the real cache and avoid to have to lower case all paths before each file operation. Can you try to set the perms correctly and tell me if it works out for you? Should work on any windows supported version. [2013-01-10 12:34:52] paj...@php.net Quick notice to help to understand the problem describe here: The main problem here is that FindFirstFile requires access to all elements of a given path, which is not the case here. To work around this limitation while keeping the realpath cache working nicely is not that easy. 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
Bug #43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
Edit report at https://bugs.php.net/bug.php?id=43817&edit=1 ID: 43817 Updated by: paj...@php.net 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: 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. Previous Comments: [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. [2013-01-14 11:26:46] paj...@php.net Ok, the actual issue is about setting the right permissions. It is possible to block read&write and other operations but the read of the attribute of a given path must be allowed. It is used by almost all file functions(Find*, GetLong/ShortPathName, etc.). Without the permissions allowing to read attributes, we won't be able to fetch the actual name (ie: c:\Foo is given but the actual name is c:\fOo). We used the actual to store it in the real cache and avoid to have to lower case all paths before each file operation. Can you try to set the perms correctly and tell me if it works out for you? Should work on any windows supported version. [2013-01-10 12:34:52] paj...@php.net Quick notice to help to understand the problem describe here: The main problem here is that FindFirstFile requires access to all elements of a given path, which is not the case here. To work around this limitation while keeping the realpath cache working nicely is not that easy. [2012-10-18 11:49:00] y dot korotia at hotmail dot com are you going to fix it for Windows or not? I've wasted about 4 hours because of this bug! installed ZendServer with 5.3x To access folder I must give access to its parent. what a f..? [2012-07-18 06:53:55] denis at morozov dot tk W2008R2x64+PHP5.3.8.: have got the same error+ In my case is_dir() is not affected, but opendir() fails. Directory is in the root of system disk, directories inside wwwroot are not affected. If started from CMD with Admin - no error, error comes only in case of IUSR-IIS calls. IN: $dir="E:\\temp\\"; $dh=opendir($dir); OUT: PHP Warning: opendir(E:\temp\,E:\temp\) [function.opendir]: ÐÑказано в доÑÑÑпе. (code: 5) in E:\inetpub\dm\iPrinter\dir.php 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
Bug #43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
Edit report at https://bugs.php.net/bug.php?id=43817&edit=1 ID: 43817 Updated by: paj...@php.net 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: Ok, the actual issue is about setting the right permissions. It is possible to block read&write and other operations but the read of the attribute of a given path must be allowed. It is used by almost all file functions(Find*, GetLong/ShortPathName, etc.). Without the permissions allowing to read attributes, we won't be able to fetch the actual name (ie: c:\Foo is given but the actual name is c:\fOo). We used the actual to store it in the real cache and avoid to have to lower case all paths before each file operation. Can you try to set the perms correctly and tell me if it works out for you? Should work on any windows supported version. Previous Comments: [2013-01-10 12:34:52] paj...@php.net Quick notice to help to understand the problem describe here: The main problem here is that FindFirstFile requires access to all elements of a given path, which is not the case here. To work around this limitation while keeping the realpath cache working nicely is not that easy. [2012-10-18 11:49:00] y dot korotia at hotmail dot com are you going to fix it for Windows or not? I've wasted about 4 hours because of this bug! installed ZendServer with 5.3x To access folder I must give access to its parent. what a f..? [2012-07-18 06:53:55] denis at morozov dot tk W2008R2x64+PHP5.3.8.: have got the same error+ In my case is_dir() is not affected, but opendir() fails. Directory is in the root of system disk, directories inside wwwroot are not affected. If started from CMD with Admin - no error, error comes only in case of IUSR-IIS calls. IN: $dir="E:\\temp\\"; $dh=opendir($dir); OUT: PHP Warning: opendir(E:\temp\,E:\temp\) [function.opendir]: ÐÑказано в доÑÑÑпе. (code: 5) in E:\inetpub\dm\iPrinter\dir.php [2011-02-01 22:42:03] asankel at yahoo dot com UPDATE: This problem does not occur with php-5.2.17-nts-Win32-VC6-x86 so you can use it as a workaround. [2011-01-29 00:22:42] asankel at yahoo dot com Never mind on the workaround. Was related to some fastcgi caching. If you are running fastcgi the parent directory check is only done the first time. If it has access the first time it won't check the parent directory for further accesses. 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
Bug #43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
Edit report at https://bugs.php.net/bug.php?id=43817&edit=1 ID: 43817 Updated by: paj...@php.net 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: Quick notice to help to understand the problem describe here: The main problem here is that FindFirstFile requires access to all elements of a given path, which is not the case here. To work around this limitation while keeping the realpath cache working nicely is not that easy. Previous Comments: [2012-10-18 11:49:00] y dot korotia at hotmail dot com are you going to fix it for Windows or not? I've wasted about 4 hours because of this bug! installed ZendServer with 5.3x To access folder I must give access to its parent. what a f..? [2012-07-18 06:53:55] denis at morozov dot tk W2008R2x64+PHP5.3.8.: have got the same error+ In my case is_dir() is not affected, but opendir() fails. Directory is in the root of system disk, directories inside wwwroot are not affected. If started from CMD with Admin - no error, error comes only in case of IUSR-IIS calls. IN: $dir="E:\\temp\\"; $dh=opendir($dir); OUT: PHP Warning: opendir(E:\temp\,E:\temp\) [function.opendir]: ÐÑказано в доÑÑÑпе. (code: 5) in E:\inetpub\dm\iPrinter\dir.php [2011-02-01 22:42:03] asankel at yahoo dot com UPDATE: This problem does not occur with php-5.2.17-nts-Win32-VC6-x86 so you can use it as a workaround. [2011-01-29 00:22:42] asankel at yahoo dot com Never mind on the workaround. Was related to some fastcgi caching. If you are running fastcgi the parent directory check is only done the first time. If it has access the first time it won't check the parent directory for further accesses. [2011-01-29 00:11:37] asankel at yahoo dot com Same problem with PHP 5.3.5 on Windows 2008 with IIS 7. Workaround is to add "\." to the end of the path and then PHP doesn't attempt to access the parent directories at all. For example, change "d:\files\directory\test" to "d:\files\directory\test\." 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
Bug #43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
Edit report at http://bugs.php.net/bug.php?id=43817&edit=1 ID: 43817 Updated by: dani...@php.net 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 New Comment: That makes sense. I'm on XP. Thanks. If you need quicker feedback, shoot me an email or assign the bug to me. Previous Comments: [2010-04-05 01:59:43] paj...@php.net Nothing has changed in 5.2/3.x about that. The problem may come from the tsrm's real path which tries to access all parent directories to cache them. I have to investigate why it fails on XP (and on on 2003 for your right?) but not on more recent versions. [2010-04-05 01:45:01] dani...@php.net I just installed 5.3.2. The regression has gotten worse. Now the "Subdir/.." workaround fails too: Warning: opendir(C:/Dir/Subdir/..,C:/Dir/Subdir/..) [function.opendir]: Access is denied. (code: 5)... [2010-03-29 00:27:55] paj...@php.net Please try with 5.3.2 [2010-03-29 00:12:25] dani...@php.net Still exists for me under the official release of PHP 5.3.0 on an XP SP3 machine. [2009-06-28 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". 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 http://bugs.php.net/bug.php?id=43817 -- Edit this bug report at http://bugs.php.net/bug.php?id=43817&edit=1
Bug #43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
Edit report at http://bugs.php.net/bug.php?id=43817&edit=1 ID: 43817 Updated by: paj...@php.net 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 New Comment: Nothing has changed in 5.2/3.x about that. The problem may come from the tsrm's real path which tries to access all parent directories to cache them. I have to investigate why it fails on XP (and on on 2003 for your right?) but not on more recent versions. Previous Comments: [2010-04-05 01:45:01] dani...@php.net I just installed 5.3.2. The regression has gotten worse. Now the "Subdir/.." workaround fails too: Warning: opendir(C:/Dir/Subdir/..,C:/Dir/Subdir/..) [function.opendir]: Access is denied. (code: 5)... [2010-03-29 00:27:55] paj...@php.net Please try with 5.3.2 [2010-03-29 00:12:25] dani...@php.net Still exists for me under the official release of PHP 5.3.0 on an XP SP3 machine. [2009-06-28 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". [2009-06-20 11:39:09] paj...@php.net Can't reproduce it with RC4, please try again with 5.3.0RC4. 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 http://bugs.php.net/bug.php?id=43817 -- Edit this bug report at http://bugs.php.net/bug.php?id=43817&edit=1
#43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
ID: 43817 Updated by: paj...@php.net Reported By: losd at mail dot dk Status: Assigned Bug Type: Directory function related Operating System: Windows Server 2003 PHP Version: 5.3.0beta1 Assigned To: pajoye New Comment: Also see #42832 Previous Comments: [2009-03-02 20:01:18] paj...@php.net I can now reproduce it on XP, but not on 2008/Vista/win7. I have to investigate deeper :P [2009-02-03 17:36:35] dani...@php.net Changing version from 5.2.5 to 5.3.0beta1 to facilitate this getting fixed before the next release. [2009-02-03 15:31:49] dani...@php.net This problem still exists in 5.3.0 beta 1 (http://windows.php.net/downloads/qa/php-5.3.0beta1-Win32-VC6-x86.zip) [2008-08-12 09:42:06] dmi...@php.net Fixed in CVS HEAD and PHP_5_3. [2008-03-01 09:09:15] losd at mail dot dk Doh, sorry, thought I could edit the original text. Just delete that comment. But yes, as Daniel correctly points out, it's all Windows permission handling (As my reproduce code also shows), not just related to network shares... I experienced it in one at first, I guess that's why it stuck in my brain. 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 http://bugs.php.net/43817 -- Edit this bug report at http://bugs.php.net/?id=43817&edit=1
#43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
ID: 43817 Updated by: paj...@php.net Reported By: losd at mail dot dk Status: Assigned Bug Type: Directory function related Operating System: Windows Server 2003 PHP Version: 5.3.0beta1 Assigned To: pajoye New Comment: I can now reproduce it on XP, but not on 2008/Vista/win7. I have to investigate deeper :P Previous Comments: [2009-02-03 17:36:35] dani...@php.net Changing version from 5.2.5 to 5.3.0beta1 to facilitate this getting fixed before the next release. [2009-02-03 15:31:49] dani...@php.net This problem still exists in 5.3.0 beta 1 (http://windows.php.net/downloads/qa/php-5.3.0beta1-Win32-VC6-x86.zip) [2008-08-12 09:42:06] dmi...@php.net Fixed in CVS HEAD and PHP_5_3. [2008-03-01 09:09:15] losd at mail dot dk Doh, sorry, thought I could edit the original text. Just delete that comment. But yes, as Daniel correctly points out, it's all Windows permission handling (As my reproduce code also shows), not just related to network shares... I experienced it in one at first, I guess that's why it stuck in my brain. [2008-03-01 09:02:02] losd at mail dot dk Description: If the parent directory of a Windows directory 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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? 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 http://bugs.php.net/43817 -- Edit this bug report at http://bugs.php.net/?id=43817&edit=1
#43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
ID: 43817 Updated by: dani...@php.net Reported By: losd at mail dot dk Status: Assigned Bug Type: Directory function related Operating System: Windows Server 2003 -PHP Version: 5.2.5 +PHP Version: 5.3.0beta1 Assigned To: dmitry New Comment: Changing version from 5.2.5 to 5.3.0beta1 to facilitate this getting fixed before the next release. Previous Comments: [2009-02-03 15:31:49] dani...@php.net This problem still exists in 5.3.0 beta 1 (http://windows.php.net/downloads/qa/php-5.3.0beta1-Win32-VC6-x86.zip) [2008-08-12 09:42:06] dmi...@php.net Fixed in CVS HEAD and PHP_5_3. [2008-03-01 09:09:15] losd at mail dot dk Doh, sorry, thought I could edit the original text. Just delete that comment. But yes, as Daniel correctly points out, it's all Windows permission handling (As my reproduce code also shows), not just related to network shares... I experienced it in one at first, I guess that's why it stuck in my brain. [2008-03-01 09:02:02] losd at mail dot dk Description: If the parent directory of a Windows directory 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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? [2008-03-01 01:10:46] dani...@php.net 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. 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 http://bugs.php.net/43817 -- Edit this bug report at http://bugs.php.net/?id=43817&edit=1
#43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
ID: 43817 User updated by: losd at mail dot dk 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: Doh, sorry, thought I could edit the original text. Just delete that comment. But yes, as Daniel correctly points out, it's all Windows permission handling (As my reproduce code also shows), not just related to network shares... I experienced it in one at first, I guess that's why it stuck in my brain. Previous Comments: [2008-03-01 09:02:02] losd at mail dot dk Description: If the parent directory of a Windows directory 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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? [2008-03-01 01:10:46] [EMAIL PROTECTED] 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. [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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? ---
#43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
ID: 43817 User updated by: losd at mail dot dk 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: Description: If the parent directory of a Windows directory 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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? Previous Comments: [2008-03-01 01:10:46] [EMAIL PROTECTED] 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. [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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? -- Edit this bug report at http://bugs.php.net/?id=43817&edit=1
#43817 [Asn]: opendir() fails on Windows directories with parent directory unaccessible
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 yyy.txt Subdir/ xxx.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: --- "; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } echo ""; if ($handle = opendir("C:/Test/NoAccess/Access")) { echo "Opened directory C:/Test/NoAccess/Access"; while (false !== ($file = readdir($handle))) echo"File: $file"; closedir($handle); } else { echo "H, can't open directory, is it accessible?"; } ?> Expected result: Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.txt Opened dir C:/Test/NoAccess/Access File: . File: .. File: yyy.txt File: Subdir Actual result: -- Opened dir C:/Test/NoAccess/Access/Subdir File: . File: .. File: xxx.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 H, can't open directory, is it accessible? -- Edit this bug report at http://bugs.php.net/?id=43817&edit=1