ID: 41518 Updated by: [EMAIL PROTECTED] Reported By: ruben dot willmes at emil2001 dot de -Status: Open +Status: Bogus Bug Type: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.2 New Comment:
If we remove this warning for non-existent files, it could be possible to use file_exists() to detect which files exists (since it's perfectly legal to print this warning when the file exists). Previous Comments: ------------------------------------------------------------------------ [2007-05-29 06:58:06] ruben dot willmes at emil2001 dot de You're right, it does work correctly if i set my open_basedir to '/var/ www/localhost/htdocs' (without the trailing slash). But if i set it to '/var/www/localhost/htdocs/' (with the trailing slash), it doesn't work in my test case. Could you please try it once more setting your open_basedir to '/www/home/user/' (with the trailing slash)? The system this is running on is PHP 5.2.2, with Apache 2.0.58. thx in advance ------------------------------------------------------------------------ [2007-05-28 22:09:25] xeo2001 at yahoo dot com Ow. i forgot to mantion that the server also runs php 5 and 6. While only tested in php 4 and 5. ------------------------------------------------------------------------ [2007-05-28 22:05:11] xeo2001 at yahoo dot com I have to disagree with you. I'v set a open base dir as /www/home/user and when i open (the by you produced code) in /www/home/user/test.php as: <? if (is_file('/www/home/user/index.phph')) { print "File exists"; }else { print "File does not exist"; } ?> I just get the text "File does not exist". I think you got a problem in your server configuration? Running system(s): Debian 4.1 Apache 1.3.37 Php 4.4.7 ------------------------------------------------------------------------ [2007-05-28 13:38:43] ruben dot willmes at emil2001 dot de Description: ------------ If open_basedir is active, file_exists(), as well as is_dir() and is_file(), throw an open_basedir warning if you check a non-existent file in a directory mentioned in the open_basedir configuration. The directories used in this case aren't symlinks. The following example describes the situation with is_file(), but you'll get the same result with is_dir() and file_exists(). For a reference please see Bug #24313 http://bugs.php.net/bug.php?id=24313 Sorry if this is a dub, but i didn't found any bugs referring to the actual PHP version Reproduce code: --------------- if (is_file('/var/www/localhost/htdocs/index.phph')) { print "File exists"; } else { print "File does not exist"; } Expected result: ---------------- is_file should return a FALSE and you should read "File does not exist". Actual result: -------------- In addition to "File does not exist", you'll get a warning that open_basedir restriction is in effect: Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/var/www/localhost/htdocs/index.phph) is not within the allowed path(s): (/var/www/localhost/htdocs/) in /var/www/localhost/ htdocs/check.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41518&edit=1