#38423 [Opn->Bgs]: unexpected warning with file_exists() and open_base_dir

From: Date: Fri, 11 Aug 2006 11:08:21 +0000
Subject: #38423 [Opn->Bgs]: unexpected warning with file_exists() and open_base_dir
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-100689@lists.php.net to get a copy of this message
ID: 38423 Updated by: tony2001@php.net Reported By: lars at schafft dot org -Status: Open +Status: Bogus Bug Type: Safe Mode/open_basedir Operating System: Linux SuSE 9.2 PHP Version: 5.1.4 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2006-08-11 11:02:35] 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 10:32:39] tony2001@php.net The /opt or /opt/cms directory is a symlink, right? ------------------------------------------------------------------------ [2006-08-11 10:30:52] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38423&edit=1

« previous php.bugs (#100689) next »