php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19299 is_readable and other file functions report 'Can't stat'
Submitted: 2002-09-09 01:15 UTC Modified: 2002-09-09 05:19 UTC
From: nic at coombs dot anu dot edu dot au Assigned:
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 4.2.2 OS: Solaris 7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nic at coombs dot anu dot edu dot au
New email:
PHP Version: OS:

 

 [2002-09-09 01:15 UTC] nic at coombs dot anu dot edu dot au
is_readable(), file_exists() and possibly other similar functions return Warning stat failed errors if the file for which the function is called is in a directory for which the www user (Apache) does not have permissions to read.

The functions still return the appropriate values, but the error output is annoying. While I undestand why the error is occuring, a function with a name such as is_readable should suppress these warnings and simply return false if it cannot read the file.

Thanks, Nic.

Code and error stuff follow.

<?PHP
echo $file;
echo ": ";
if (file_exists($file)) {
echo " exists";
}
else {
echo " dont exist";
}
if(is_readable($file)) {
echo "readable";
}
else {echo "not readable";}
?>

In the case below the directory 'poo' is not world readable, but does exist.

poo/poo.txt:
Warning: stat failed for poo/poo.txt (errno=13 - Permission denied) in /opt/apache_1.3.26/htdocs/is_read_test.php on line 6
dont exist
Warning: stat failed for poo/poo.txt (errno=13 - Permission denied) in /opt/apache_1.3.26/htdocs/is_read_test.php on line 12
not readable

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-09 05:19 UTC] sniper@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC