|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-08 01:52 UTC] don at blacksun dot org
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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu May 28 02:00:01 2026 UTC |
Here is the error: Warning: stat failed for index/nothing (errno=20 - Not a directory) in /usr/local/www/htdocs/support/index.php "index" is a regular file. A file_exists("index/nothing"); returns a stat error. -Don