#19299 [Opn->Csd]: is_readable and other file functions report 'Can't stat'

From: Date: Mon, 09 Sep 2002 10:19:04 +0000
Subject: #19299 [Opn->Csd]: is_readable and other file functions report 'Can't stat'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18737@lists.php.net to get a copy of this message
ID: 19299 Updated by: sniper@php.net Reported By: nic@coombs.anu.edu.au -Status: Open +Status: Closed Bug Type: *Directory/Filesystem functions Operating System: Solaris 7 PHP Version: 4.2.2 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2002-09-09 01:15:22] nic@coombs.anu.edu.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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19299&edit=1

« previous php.bugs (#18737) next »