Edit report at https://bugs.php.net/bug.php?id=65211&edit=1

 ID:                 65211
 Comment by:         mail+php at requinix dot net
 Reported by:        paolo at schiro dot it
 Summary:            file_exists() warns of open_basedir on existing file
                     mis-used as directory
 Status:             Open
 Type:               Bug
 Package:            Safe Mode/open_basedir
 Operating System:   Linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Duplicate of
- bug 52065 "Warning about open_basedir restriction while accessing a file as 
directory"
- bug 53041 "is_file() and open_basedir" closed to due no feedback (@pajoye: 
yes)

tl;dr: bug is not about open_basedir itself but rather some code being unable 
to 
access the file (rightly so) and the calling code assuming the failure is 
because 
of open_basedir.


Previous Comments:
------------------------------------------------------------------------
[2013-07-05 17:05:45] 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:



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65211&edit=1

Reply via email to