ID: 44859 Comment by: carsten_sttgt at gmx dot de Reported By: phpbugs at steve dot ipapp dot com Status: Open Bug Type: Filesystem function related Operating System: Win 2000 SP4 PHP Version: 5.2.5 New Comment:
| NT ACL Permissions ... | is_readable() doesn't seem to care and thinks that all | these files are readable, when in fact they aren't. I just run into the same problem and can verify/reproduce this :-/ | is_writeable() probably has the same problem. Correct. is_writeable() only looks for the "read-only" file system attribute (this one works). But like is_readable(), it does not make a real UID/GID check on Windows. And there is no similar attribute for is_readable(), so is_readable() is useless on Windows at the moment. Regards, Carsten Previous Comments: ------------------------------------------------------------------------ [2008-04-29 00:27:27] phpbugs at steve dot ipapp dot com Description: ------------ NT ACL Permissions can be modified in Windows by right clicking on the file, going to properties, and security. Clicking the Everyone user and hitting Deny Read, will prevent ANYTHING from reading, even if they have READ permissions granted elsewhere. is_readable() doesn't seem to care and thinks that all these files are readable, when in fact they aren't. is_writeable() probably has the same problem. Previous Bugs Identified with this have been closed: 41519. Reproduce code: --------------- $some_file = 'C:\\path\to\file.txt'; if(is_readable($some_file)) { echo file_get_contents($some_file); } else { echo "This file isn't readable"; } Expected result: ---------------- With NTFS ACL Permissions set to allow reading: *Contents of File* With NTFS ACL Permissions set to disallow reading: "This file isn't readable"; Actual result: -------------- With NTFS ACL Permissions set to allow reading: *Contents of File* With NTFS ACL Permissions set to disallow reading: Warning: file_get_contents(C:\\path\to\file.txt) [function.file-get-contents]: failed to open stream: Permission denied in C:\\path\to\script.php on line 4 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44859&edit=1