mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
fixed glob() edge case on windows, ref bug #47358
This commit is contained in:
parent
f61b648da4
commit
f4df40108b
@ -491,11 +491,18 @@ PHP_FUNCTION(glob)
|
||||
/* now catch the FreeBSD style of "no matches" */
|
||||
if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
|
||||
no_results:
|
||||
#ifndef PHP_WIN32
|
||||
/* Paths containing '*', '?' and some other chars are
|
||||
illegal on Windows but legit on other platforms. For
|
||||
this reason the direct basedir check against the glob
|
||||
query is senseless on windows. For instance while *.txt
|
||||
is a pretty valid filename on EXT3, it's invalid on NTFS. */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
if (php_check_open_basedir_ex(pattern, 0 TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
array_init(return_value);
|
||||
return;
|
||||
}
|
||||
|
@ -6,9 +6,27 @@ $path = dirname(__FILE__);
|
||||
|
||||
ini_set('open_basedir', NULL);
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
ini_set('open_basedir', $path);
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
ini_set('open_basedir', '/tmp');
|
||||
var_dump(glob("$path/*.none"));
|
||||
var_dump(glob("$path/?.none"));
|
||||
var_dump(glob("$path/*{hello,world}.none"));
|
||||
var_dump(glob("$path/*/nothere"));
|
||||
var_dump(glob("$path/[aoeu]*.none"));
|
||||
var_dump(glob("$path/directly_not_exists"));
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
@ -17,4 +35,36 @@ array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
==DONE==
|
||||
|
Loading…
Reference in New Issue
Block a user