From: Ilia Alshanetsky Date: Wed, 23 Jul 2003 21:41:53 +0000 (+0000) Subject: MFH: Fixed GLOB_ONLYDIR to work on GNU libc based system. X-Git-Tag: php-4.3.3RC2~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b278b99605e1ae9dc8fc9dbbfab9634fbb3b4dd5;p=php MFH: Fixed GLOB_ONLYDIR to work on GNU libc based system. --- diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 23ccd8ab47..13d4ecc291 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -411,7 +411,14 @@ PHP_FUNCTION(glob) array_init(return_value); for (n = 0; n < globbuf.gl_pathc; n++) { -#ifdef GLOB_EMULATE_ONLYDIR + /* we need to this everytime since GLOB_ONLYDIR does not guarantee that + * all directories will be filtered. GNU libc documentation states the + * following: + * If the information about the type of the file is easily available + * non-directories will be rejected but no extra work will be done to + * determine the information for each file. I.e., the caller must still be + * able to filter directories out. + */ if (flags & GLOB_ONLYDIR) { struct stat s; @@ -423,7 +430,6 @@ PHP_FUNCTION(glob) continue; } } -#endif add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip, 1); }