|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-16 21:55 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 21:00:01 2025 UTC |
Description: ------------ I have searched the bug reports, and have seen other reports of this problem that were closed; however they were pretty old, and the bug persists. BUG: If an absolute path is used with the file_exists() function, it will ALWAYS report the file doesn't exist. ie: file_exists('/images/mypic.gif') ALWAYS reports false. Only by specifying a relative path, will the function start working. Although my ISP is still running php 4.2.3, I've checked the change log, and there is no indication that this bug has been addressed. I have no control over my ISP, and therefore no ability to upgrade; however, as I've said, there is nothing in ANY of the changelogs to indicate this bug has been addressed. Reproduce code: --------------- here is sample code illustrating the problem: you may observe the code here (and get source): http://www.rjservices.com/bugs/fileexist.php <html><body><BR> this file is using php's file_exists() function to look at itself.<br> the function ONLY works correctly if a RELATIVE path for the filename is used!<br> if an absolute path is used, is ALWAYS reports the file doesn't exist!<br> <?php $g="../bugs/fileexist.php"; $b="/bugs/fileexist.php"; if (file_exists($g)) $t="true"; else $t="false"; print "\n<BR>good file is ".$g." and it exists? - ".$t; if (file_exists($b)) $t="true"; else $t="false"; print "\n<BR>bad file is ".$b." and it exists? - ".$t; ?> <BR><BR> here's the code used in this file: <a href="http://www.rjservices.com/bugs/fileexist.php.txt">fileexist.php</a> <br> This system is running PHP 4.2.3, and Apache/1.3.23<br> and runs on (Red-Hat/Linux) PHP/4.2.3 <br> </body></html> Expected result: ---------------- file_exists("/bugs/fileexist.php") SHOULD return TRUE; it doesn't. (and the file DOES exist:) Actual result: -------------- file_exists("/bugs/fileexist.php") returns FALSE; (and the file DOES exist)