php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38423 unexpected warning with file_exists() and open_base_dir
Submitted: 2006-08-11 10:30 UTC Modified: 2006-08-11 11:08 UTC
From: lars at schafft dot org Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5.1.4 OS: Linux SuSE 9.2
Private report: No CVE-ID: None
 [2006-08-11 10:30 UTC] lars at schafft dot org
Description:
------------
Trying to check if a file to include exists. Path, where file to be checked, is in open_base_dir. But if the file does not exists, the function throws a warning concerning open_basedir restrictions

Reproduce code:
---------------
if (file_exists('/opt/cms/modules/stats/frontend/stats.parser.html.class.php')) {
  echo 'found';
}

Expected result:
----------------
file_exists() returns false without a warning

Actual result:
--------------
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/opt/cms/modules/stats/frontend/stats.parser.html.class.php) is not within the allowed path(s): (/srv/www/htdocs/web2:/usr/lib/php:/opt/cms

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-11 10:32 UTC] tony2001@php.net
The /opt or /opt/cms directory is a symlink, right?
 [2006-08-11 11:02 UTC] lars at schafft dot org
/opt/cms is a symlink, that?s right.

But that didn?t cause any warnings prior to PHP 5.1
 [2006-08-11 11:08 UTC] tony2001@php.net
You need to use the real path in both php.ini directive and fopen(), since PHP resolves all symlinks and compares the real path with open_basedir value.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 05:01:27 2024 UTC