diff options
author | Hartmut Holzgraefe <hholzgra@php.net> | 2003-06-03 11:01:16 +0000 |
---|---|---|
committer | Hartmut Holzgraefe <hholzgra@php.net> | 2003-06-03 11:01:16 +0000 |
commit | c83ed19a7b488b44172120e76cb09119a99cde4b (patch) | |
tree | 07e0b2c9466d8201eefbb86dbc84dd2edad0d556 | |
parent | b7713f411e468c01f4f6a5d3eae5f9441101ca12 (diff) | |
download | php-git-c83ed19a7b488b44172120e76cb09119a99cde4b.tar.gz |
handle return value for "no matches" on systems that don't return
GLOB_NOMATCH consistent to those that do (return array(), not FALSE)
-rw-r--r-- | ext/standard/dir.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 4396a54566..cfa792f477 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -400,11 +400,16 @@ PHP_FUNCTION(glob) RETURN_FALSE; } +#ifndef GLOB_NOMATCH + // now catch the FreeBSD style of "no matches" + if (!globbuf.gl_pathc) { + array_init(return_value); + return; + } +#endif + /* we assume that any glob pattern will match files from one directory only so checking the dirname of the first match should be sufficient */ - if (!globbuf.gl_pathv) { - RETURN_FALSE; - } strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN); if (PG(safe_mode) && (!php_checkuid(cwd, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { RETURN_FALSE; |