#23190 [NEW]: Debugging output of file_exists is misleading

From: Date: Mon, 14 Apr 2003 00:44:12 +0000
Subject: #23190 [NEW]: Debugging output of file_exists is misleading
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37623@lists.php.net to get a copy of this message
From: d dot tonhofer at m-plify dot com Operating system: Linux 2.4.18 PHP version: 4.3.1 PHP Bug Type: Filesystem function related Bug description: Debugging output of file_exists is misleading file_exists gives a misleading error message if open_basedir is in effect. Example: <?php error_reporting(E_ALL); # We have: # open_basedir = /var/www/htdocs/site-com-prod:/var/www/htdocs/site-com-test:/usr/local/phpwiki // get $filename from parameters if (file_exists($filename)) { print "The file $filename exists"; } else { print "The file $filename does not exist"; } ?> Results: The following give no problem, just the 'does not exist' result: $filename = '/var/www/htdocs/site-com-prod/i_dont_exist.txt'; $filename = '/var/www/htdocs/site-com-test/i_dont_exist.txt'; $filename = '/usr/local/phpwiki-1.3.4'; Now we try something outsid of the open_basedir path set: $filename = '/etc/passwd'; We get: PHP Warning: file_exists() [<a href='http://www.php.net/function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/etc/passwd) is not within the allowed path(s): (/var/www/htdocs/site-com-prod) in /usr/local/phpwiki-1.3.4/test.php on line 12 Clearly, the open_basedir path indicated by file_exists() in this error message is wrong & confusing. -- Edit bug report at http://bugs.php.net/?id=23190&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23190&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23190&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23190&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23190&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23190&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23190&r=support Expected behavior: http://bugs.php.net/fix.php?id=23190&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23190&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23190&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23190&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23190&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23190&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23190&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23190&r=gnused

« previous php.bugs (#37623) next »