#23190 [Opn->Bgs]: Debugging output of file_exists is misleading

From: Date: Mon, 14 Apr 2003 04:19:31 +0000
Subject: #23190 [Opn->Bgs]: Debugging output of file_exists is misleading
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37631@lists.php.net to get a copy of this message
ID: 23190 Updated by: pollita@php.net Reported By: d dot tonhofer at m-plify dot com -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Linux 2.4.18 PHP Version: 4.3.1 New Comment: This bug was already reported in this bug system and was fixed. The fix will appear in PHP 4.3.2 Previous Comments: ------------------------------------------------------------------------ [2003-04-13 19:44:12] d dot tonhofer at m-plify dot com 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 this bug report at http://bugs.php.net/?id=23190&edit=1

« previous php.bugs (#37631) next »