|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-06-11 17:14 UTC] dr at peytz dot dk
Description:
------------
file_exists() etc. does not allow checking the existence of files outside the directories specified in open_basedir.
This can be circumvented using glob(). glob() does check open_basedir, but its return type still reveals whether files exist outside open_basedir. The existence of a file can be checked using !is_array(glob($filename)).
Reproduce code:
---------------
var_dump(glob('/etc/hosts'));
var_dump(glob('/etc/does-not-exist'));
Expected result:
----------------
bool(false)
bool(false)
or
array(0) {
}
array(0) {
}
Actual result:
--------------
bool(false)
array(0) {
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 10:00:01 2025 UTC |
The fix for this bug introduced a regression. Using: $a =glob("/home/pierre/cvs/php52/ext/*/tests/*");' Where: open_basedir = /home/pierre/cvs/php52 glob fails to access this path: Warning: glob(): Unable to access /home/pierre/cvs/php52/ext/*/tests in Command line code on line 1