PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #44859 is_readable() returns incorrect result with NTFS ACL permissions
Submitted:29 Apr 2008 12:27am UTC Modified: 17 May 7:54pm UTC
From:phpbugs at steve dot ipapp dot com Assigned to:pajoye
Status:Closed Category:Filesystem function related
Version:5.2.6 OS:win32 only
Votes:2 Avg. Score:4.0 ± 0.0 Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%) Same OS:1 (50.0%)
View/Vote Developer Edit Submission

[29 Apr 2008 12:27am UTC] 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
[8 Jul 2008 5:11pm UTC] carsten_sttgt at gmx dot de
| 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
[17 May 7:54pm UTC] pajoye@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

fixed in 5.3 and HEAD (6)

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC