Browse Source

handle return value for "no matches" on systems that don't return

GLOB_NOMATCH consistent to those that do (return array(), not FALSE)
migration/unlabaled-1.3.2
Hartmut Holzgraefe 24 years ago
parent
commit
c83ed19a7b
  1. 11
      ext/standard/dir.c

11
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;

Loading…
Cancel
Save