|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-07-05 17:05 UTC] paolo at schiro dot it
Description:
------------
When open_basedir set file_exists() raise an open_basedir warning
when checking a path which permitted by open_basedir but includes
an existent file misused as directory.
Test script:
---------------
//create a file
$fhandle = fopen('existing-file-which-is-not-dir.txt', 'w');
//throw your mind away and use it as a directory
if (is_file('existing-file-which-is-not-dir.txt/test.html')) {
print "File exists";
} else {
print "File does not exist";
}
//show the error
print_r(error_get_last());
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:
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 13:00:01 2025 UTC |
File functions produce warning if argument is a path which starts with existing file. <? touch('./index.php'); ini_set('open_basedir', '.'); var_dump(file_exists('./index.php/.section.php')); ?> Expected result: bool(false) Actual result: Warning: file_exists(): open_basedir restriction in effect. File(./index.php/.section.php) is not within the allowed path(s): (.) in ***/1.php on line 4 bool(false) OS FreeBSD. PHP 5.3, 5.4 affected. PHP 5.2 not affected.