ID:               42832
 User updated by:  jmboyd at bluebottle dot com
 Reported By:      jmboyd at bluebottle dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Directory function related
 Operating System: Windows 2000
 PHP Version:      5.2.4
 New Comment:

Same result with the snapshot (from 03 Oct 2007 20:09:47):

C:\parentdir\subdir>\php525dev\php -r "foreach(scandir('.') as $f) {
echo($f); }"

Warning: scandir(.): failed to open dir: Bad file descriptor in Command
line code on line 1

Warning: scandir(): (errno 9): Bad file descriptor in Command line code
on line 1

Warning: Invalid argument supplied for foreach() in Command line code
on line 1


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

[2007-10-03 08:18:07] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi



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

[2007-10-02 17:57:35] jmboyd at bluebottle dot com

Description:
------------
A user must have permissions for a directory's parent in order to scan
it with scandir.  If the user does not have permissions (for instance,
user has "Full Control" over the subdir but is not in the parent's ACL
at all), php fails with a "failed to open dir: Bad file descriptor"
error followed by a "(errno 9): Bad file descriptor" error.

Based on the quick test in the "Actual results" box below, this bug
seems to have arrived between 5.2.1 and 5.2.2.  No php.ini is in use in
any of the tests.

Reproduce code:
---------------
Any use of scandir will work, here's a quick one to do from the command
line, after cding to the subdir:

php -r "foreach(scandir('.') as $f) { echo($f); }"

Expected result:
----------------
The subdirectory's filenames (all run together):

...file1.txtfile2.txtfile3.txt

Actual result:
--------------
C:\>cd \parentdir
Access is denied.

C:\>cd \parentdir\subdir

C:\parentdir\subdir>dir /B
file1.txt
file2.txt
file3.txt

C:\parentdir\subdir>\php521\php -r "foreach(scandir('.') as $f) {
echo($f); }"
...file1.txtfile2.txtfile3.txt
C:\parentdir\subdir>\php522\php -r "foreach(scandir('.') as $f) {
echo($f); }"

Warning: scandir(.): failed to open dir: Bad file descriptor in Command
line code on line 1

Warning: scandir(): (errno 9): Bad file descriptor in Command line code
on line 1

Warning: Invalid argument supplied for foreach() in Command line code
on line 1

C:\parentdir\subdir>\php524\php -r "foreach(scandir('.') as $f) {
echo($f); }"

Warning: scandir(.): failed to open dir: Bad file descriptor in Command
line code on line 1

Warning: scandir(): (errno 9): Bad file descriptor in Command line code
on line 1

Warning: Invalid argument supplied for foreach() in Command line code
on line 1


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


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

Reply via email to