Bug #16483: file_exists() results in stat() error

From: Date: Mon, 08 Apr 2002 05:52:34 +0000
Subject: Bug #16483: file_exists() results in stat() error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-4306@lists.php.net to get a copy of this message
From: don@blacksun.org Operating system: FreeBSD 4.5-STABLE PHP version: 4.1.2 PHP Bug Type: Filesystem function related Bug description: file_exists() results in stat() error If you try to stat a file that appears to be in a directory, and that directory is actually a regular file instead, file_exists() throws a stat error instead of just returning false. Needless to say this makes checking user input a lot more difficult. I am forced to check the entire path to see if each part is a directory before finally checking the last part to see whether it exists. file_exists() is a function and should either return true or false. If the file exists it should return true. If it does not (for _whatever_ reason) it should return false. Side effects like a stat error are unwanted, and can provide useful information to someone trying to attack the site. -Don -- Edit bug report at http://bugs.php.net/?id=16483&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16483&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16483&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16483&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16483&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16483&r=support Expected behavior: http://bugs.php.net/fix.php?id=16483&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16483&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16483&r=submittedtwice

« previous php.bugs (#4306) next »