#26224 [Opn]: fileperms() inaccurately reports permissions
ID: 26224 User updated by: justin dot white at mci dot com Reported By: justin dot white at mci dot com Status: Open Bug Type: Filesystem function related Operating System: Windows 2000 PHP Version: 4.3.3 New Comment: Oops. It looks like my statement about 4.3.2 was incorrect. The system I was looking at had some files labeled as Read Only in the file properties, but the file security had no bearing on the result... Back to the drawing board. Previous Comments: [2003-11-12 23:56:37] justin dot white at mci dot com I have been able to confirm that version 4.3.2 does not have this bug. I will be testing 4.3.4 shortly to see whether the bug has been resolved... [2003-11-12 13:24:05] justin dot white at mci dot com I also have a RH8 server with PHP 4.3.3 available and the sample code works flawlessly. [2003-11-12 13:23:13] justin dot white at mci dot com No, the result is the same. It appears that fileperms() and is_readable/is_writeable are all reading their permissions from file properties and not from filesystem permissions. Also, is_executable returned the following error: Fatal error: Call to undefined function: is_executable(). I didn't see where a note was given about availability in Win32 train, so I don't what is up with that. Both is_readable() and is_writeable() were available, although incorrect. [2003-11-12 13:08:10] [EMAIL PROTECTED] Does it work if you use the is_readable/is_writeable/is_executable functions instead of performing bitmask operations on the output of fileperms() ? [2003-11-12 13:06:04] justin dot white at mci dot com The server in the test setup uses NTFS in all filesystems. 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/26224 -- Edit this bug report at http://bugs.php.net/?id=26224edit=1
#26224 [Opn]: fileperms() inaccurately reports permissions
ID: 26224 User updated by: justin dot white at mci dot com Reported By: justin dot white at mci dot com Status: Open Bug Type: Filesystem function related Operating System: Windows 2000 PHP Version: 4.3.3 New Comment: The server in the test setup uses NTFS in all filesystems. Previous Comments: [2003-11-12 13:04:27] justin dot white at mci dot com Description: On Linux, PHP 4.3.3 correctly returns file permissions from the filesystem. With Windows 2000 and IIS, PHP in CGI or ISAPI mode does not. The reproduce code assumes that another file (TEST.PHP) already exists in the filesystem. Any other file or directory could be used (although the permissions are returned differently for directories). TEST.PHP can have any permissions, including explicitly DENY Full Access for EVERYONE group. Reproduce code: --- ?php clearstatcache(); $test = fileperms('c:/inetpub/wwwroot/test.php'); echo 'H1PERMS = '; $read = ($test 0x0004) ? 'r' : '-'; $write = ($test 0x0002) ? 'w' : '-'; $execute = ($test 0x0001) ? 'x' : '-'; echo $read.$write.$execute.'/H1'; ? Expected result: For files, returned results should be H1PERMS = r--/H1' if permissions were set to READ. Returned results should be H1PERMS = rw-/H1 if permissions were set to READ/WRITE or READ/WRITE/MODIFY. Returned results should be H1PERMS = rwx/H1 if permissions were set to READ/EXECUTE/WRITE or READ/EXECUTE/WRITE/MODIFY or FULL CONTROL. For directories, returned result should be similar (although permissions on directory are more well-defined). Actual result: -- For files, returned results will always be H1PERMS = rw-/H1'; For directories, returned result will always be H1PERMS = rwx/H1'; Even attempting this operation on C:/pagefile.sys returned H1PERMS = rw-. Curiously, when marking the file as read-only in the file properties (not security tab), the returned results are H1PERMS = r--/H1 for files and H1PERMS = r-x/H1 for directories. -- Edit this bug report at http://bugs.php.net/?id=26224edit=1
#26224 [Opn]: fileperms() inaccurately reports permissions
ID: 26224 User updated by: justin dot white at mci dot com Reported By: justin dot white at mci dot com Status: Open Bug Type: Filesystem function related Operating System: Windows 2000 PHP Version: 4.3.3 New Comment: I also have a RH8 server with PHP 4.3.3 available and the sample code works flawlessly. Previous Comments: [2003-11-12 13:23:13] justin dot white at mci dot com No, the result is the same. It appears that fileperms() and is_readable/is_writeable are all reading their permissions from file properties and not from filesystem permissions. Also, is_executable returned the following error: Fatal error: Call to undefined function: is_executable(). I didn't see where a note was given about availability in Win32 train, so I don't what is up with that. Both is_readable() and is_writeable() were available, although incorrect. [2003-11-12 13:08:10] [EMAIL PROTECTED] Does it work if you use the is_readable/is_writeable/is_executable functions instead of performing bitmask operations on the output of fileperms() ? [2003-11-12 13:06:04] justin dot white at mci dot com The server in the test setup uses NTFS in all filesystems. [2003-11-12 13:04:27] justin dot white at mci dot com Description: On Linux, PHP 4.3.3 correctly returns file permissions from the filesystem. With Windows 2000 and IIS, PHP in CGI or ISAPI mode does not. The reproduce code assumes that another file (TEST.PHP) already exists in the filesystem. Any other file or directory could be used (although the permissions are returned differently for directories). TEST.PHP can have any permissions, including explicitly DENY Full Access for EVERYONE group. Reproduce code: --- ?php clearstatcache(); $test = fileperms('c:/inetpub/wwwroot/test.php'); echo 'H1PERMS = '; $read = ($test 0x0004) ? 'r' : '-'; $write = ($test 0x0002) ? 'w' : '-'; $execute = ($test 0x0001) ? 'x' : '-'; echo $read.$write.$execute.'/H1'; ? Expected result: For files, returned results should be H1PERMS = r--/H1' if permissions were set to READ. Returned results should be H1PERMS = rw-/H1 if permissions were set to READ/WRITE or READ/WRITE/MODIFY. Returned results should be H1PERMS = rwx/H1 if permissions were set to READ/EXECUTE/WRITE or READ/EXECUTE/WRITE/MODIFY or FULL CONTROL. For directories, returned result should be similar (although permissions on directory are more well-defined). Actual result: -- For files, returned results will always be H1PERMS = rw-/H1'; For directories, returned result will always be H1PERMS = rwx/H1'; Even attempting this operation on C:/pagefile.sys returned H1PERMS = rw-. Curiously, when marking the file as read-only in the file properties (not security tab), the returned results are H1PERMS = r--/H1 for files and H1PERMS = r-x/H1 for directories. -- Edit this bug report at http://bugs.php.net/?id=26224edit=1
#26224 [Opn]: fileperms() inaccurately reports permissions
ID: 26224 User updated by: justin dot white at mci dot com Reported By: justin dot white at mci dot com Status: Open Bug Type: Filesystem function related Operating System: Windows 2000 PHP Version: 4.3.3 New Comment: I have been able to confirm that version 4.3.2 does not have this bug. I will be testing 4.3.4 shortly to see whether the bug has been resolved... Previous Comments: [2003-11-12 13:24:05] justin dot white at mci dot com I also have a RH8 server with PHP 4.3.3 available and the sample code works flawlessly. [2003-11-12 13:23:13] justin dot white at mci dot com No, the result is the same. It appears that fileperms() and is_readable/is_writeable are all reading their permissions from file properties and not from filesystem permissions. Also, is_executable returned the following error: Fatal error: Call to undefined function: is_executable(). I didn't see where a note was given about availability in Win32 train, so I don't what is up with that. Both is_readable() and is_writeable() were available, although incorrect. [2003-11-12 13:08:10] [EMAIL PROTECTED] Does it work if you use the is_readable/is_writeable/is_executable functions instead of performing bitmask operations on the output of fileperms() ? [2003-11-12 13:06:04] justin dot white at mci dot com The server in the test setup uses NTFS in all filesystems. [2003-11-12 13:04:27] justin dot white at mci dot com Description: On Linux, PHP 4.3.3 correctly returns file permissions from the filesystem. With Windows 2000 and IIS, PHP in CGI or ISAPI mode does not. The reproduce code assumes that another file (TEST.PHP) already exists in the filesystem. Any other file or directory could be used (although the permissions are returned differently for directories). TEST.PHP can have any permissions, including explicitly DENY Full Access for EVERYONE group. Reproduce code: --- ?php clearstatcache(); $test = fileperms('c:/inetpub/wwwroot/test.php'); echo 'H1PERMS = '; $read = ($test 0x0004) ? 'r' : '-'; $write = ($test 0x0002) ? 'w' : '-'; $execute = ($test 0x0001) ? 'x' : '-'; echo $read.$write.$execute.'/H1'; ? Expected result: For files, returned results should be H1PERMS = r--/H1' if permissions were set to READ. Returned results should be H1PERMS = rw-/H1 if permissions were set to READ/WRITE or READ/WRITE/MODIFY. Returned results should be H1PERMS = rwx/H1 if permissions were set to READ/EXECUTE/WRITE or READ/EXECUTE/WRITE/MODIFY or FULL CONTROL. For directories, returned result should be similar (although permissions on directory are more well-defined). Actual result: -- For files, returned results will always be H1PERMS = rw-/H1'; For directories, returned result will always be H1PERMS = rwx/H1'; Even attempting this operation on C:/pagefile.sys returned H1PERMS = rw-. Curiously, when marking the file as read-only in the file properties (not security tab), the returned results are H1PERMS = r--/H1 for files and H1PERMS = r-x/H1 for directories. -- Edit this bug report at http://bugs.php.net/?id=26224edit=1