|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-06-12 14:58 UTC] manuel at mausz dot at
Description:
------------
fopen_wrappers raise warning about open_basedir restriction in effect while accessing a file as a directory. This only occurs if the file exists.
Test script:
---------------
# sapi/cli/php -n -d open_basedir="$(pwd)" -r 'var_dump(is_readable("myfile/doesntexist"));'
# touch myfile
# sapi/cli/php -n -d open_basedir="$(pwd)" -r 'var_dump(is_readable("myfile/doesntexist"));'
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(false)
Warning: is_readable(): open_basedir restriction in effect. File(myfile/doesntexist) is not within the allowed path(s): (/home/manuel/php5.3-201006120030) in Command line code on line 1
bool(false)
Patchesopen-basedir-without-realpath (last revision 2015-04-29 20:11 UTC by cmb@php.net)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 01:00:01 2025 UTC |
Why isn't this bug fixed yet? It was detected in 2013 or even before. And already passed 5 years... I trying the following example with PHP 7 and I'm getting exactly the same error. <? ini_set("open_basedir", __DIR__); file_put_contents(__DIR__ . "/foo.txt", "bar"); echo "EXISTS:".file_exists(__DIR__ . "/foo.txt/"); ?> Error: PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/html/test/foo.txt/) is not within the allowed path(s): (/var/www/html/test) in /var/www/html/test/test.php on line 4 Can you please fix this and let me know please? Thankscat a.php <? ini_set("open_basedir","/home/naox/public_html/test"); mkdir("/home/naox/public_html/test"); php a.php Warning: mkdir(): open_basedir restriction in effect. File(/home/naox/public_html/test) is not within the allowed path(s): (/home/naox/public_html/test) in /home/naox/public_html/naox.vipserv.org/a.php on line 3