|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23190 Debugging output of file_exists is misleading
Submitted: 2003-04-13 19:44 UTC Modified: 2005-01-31 23:22 UTC
From: d dot tonhofer at m-plify dot com Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 4.3.1 OS: Linux 2.4.18
Private report: No CVE-ID: None
 [2003-04-13 19:44 UTC] d dot tonhofer at m-plify dot com
file_exists gives a misleading error message if
open_basedir is in effect.



# 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";



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=''>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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-13 23:19 UTC]
This bug was already reported in this bug system and was fixed.  The fix will appear in PHP 4.3.2
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 01:01:31 2024 UTC