php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41519 is_readable() returns true, when it's effectively false
Submitted: 2007-05-28 16:24 UTC Modified: 2009-08-11 15:03 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: marcelo dot schmidt+php at gmail dot com Assigned:
Status: Wont fix Package: Filesystem function related
PHP Version: 5.2.2 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marcelo dot schmidt+php at gmail dot com
New email:
PHP Version: OS:

 

 [2007-05-28 16:24 UTC] marcelo dot schmidt+php at gmail dot com
Description:
------------
I have the following permissions on a file:
Everyone have full control, though they are denied read and read & execute.
is_readable is returning true for this file, while fopen is not able to read it (which is expected).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-28 20:40 UTC] tony2001@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Ooops. Clicked wrong button.
 [2007-06-05 01:00 UTC] 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-08-11 13:59 UTC] Michael dot Heyse at fh-kl dot de
This bug still exists in PHP-5.2.11-dev (phpinfo(): System Windows NT, 5.2 build 3790, Build Date Aug 11 2009 11:42:34). Here some more detailled information.

is_readable and is_writable seem to ignore ACLs.

testcase:

The apache 2.0.63 service runs as user "apache". I created three files as follows:

- "not_readable.txt" without any permissions for user "apache"
- "readable.txt" with permissions "Read, Execute" and "Read"
- "writable.txt" with permissions "Change", "Read, Execute", "Read", "Write"

testcode:

echo 'not_readable.txt is ' . (is_writable('not_readable.txt') ? 'writable' : 'not writable') . '; ';
echo 'fopen("not_readable.txt", "a") returns ' . (@fopen("not_readable.txt", "a") ? 'true' : 'false'). '<br/>';
echo 'not_readable.txt is ' . (is_readable('not_readable.txt') ? 'readable' : 'not readable') . '; ';
echo 'fopen("not_readable.txt", "r") returns ' . (@fopen("not_readable.txt", "r") ? 'true' : 'false'). '<br/>';
echo 'readable.txt is ' . (is_writable('readable.txt') ? 'writable' : 'not writable') . '; ';
echo 'fopen("readable.txt", "a") returns ' . (@fopen("readable.txt", "a") ? 'true' : 'false'). '<br/>';
echo 'readable.txt is ' . (is_readable('readable.txt') ? 'readable' : 'not readable') . '; ';
echo 'fopen("readable.txt", "r") returns ' . (@fopen("readable.txt", "r") ? 'true' : 'false'). '<br/>';
echo 'writable.txt is ' . (is_writable('writable.txt') ? 'writable' : 'not writable') . '; ';
echo 'fopen("writable.txt", "a") returns ' . (@fopen("writable.txt", "a") ? 'true' : 'false'). '<br/>';
echo 'writable.txt is ' . (is_readable('writable.txt') ? 'readable' : 'not readable') . '; ';
echo 'fopen("writable.txt", "r") returns ' . (@fopen("writable.txt", "r") ? 'true' : 'false'). '<br/>';

actual result:

not_readable.txt is writable; fopen("not_readable.txt", "a") returns false
not_readable.txt is readable; fopen("not_readable.txt", "r") returns false
readable.txt is writable; fopen("readable.txt", "a") returns false
readable.txt is readable; fopen("readable.txt", "r") returns true
writable.txt is writable; fopen("writable.txt", "a") returns true
writable.txt is readable; fopen("writable.txt", "r") returns true

expected result:

not_readable.txt is not writable; fopen("not_readable.txt", "a") returns false
not_readable.txt is not readable; fopen("not_readable.txt", "r") returns false
readable.txt is not writable; fopen("readable.txt", "a") returns false
readable.txt is readable; fopen("readable.txt", "r") returns true
writable.txt is writable; fopen("writable.txt", "a") returns true
writable.txt is readable; fopen("writable.txt", "r") returns true
 [2009-08-11 14:00 UTC] pajoye@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-08-11 14:45 UTC] Michael dot heyse at fh-kl dot de
It does indeed work with php-5.3.1-dev. However, the production server is still running php-2.2 and can't be updated (yet).
 [2009-08-11 15:03 UTC] pajoye@php.net
We can't backport the ACL support to 5.2 (new feature).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC