edink Mon Jan 27 11:32:50 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/standard dir.c /php4/win32 glob.c /php4 NEWS Log: MFH: Fixed bug #21597 (made glob() understand Windows paths). Index: php4/ext/standard/dir.c diff -u php4/ext/standard/dir.c:1.109.2.3 php4/ext/standard/dir.c:1.109.2.4 --- php4/ext/standard/dir.c:1.109.2.3 Tue Dec 31 11:35:26 2002 +++ php4/ext/standard/dir.c Mon Jan 27 11:32:47 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dir.c,v 1.109.2.3 2002/12/31 16:35:26 sebastian Exp $ */ +/* $Id: dir.c,v 1.109.2.4 2003/01/27 16:32:47 edink Exp $ */ /* {{{ includes/startup/misc */ @@ -378,7 +378,7 @@ cwd[0] = '\0'; } cwd_skip = strlen(cwd)+1; - snprintf(work_pattern, MAXPATHLEN, "%s/%s", cwd, pattern); + snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, +pattern); pattern = work_pattern; } #endif Index: php4/win32/glob.c diff -u php4/win32/glob.c:1.3 php4/win32/glob.c:1.3.4.1 --- php4/win32/glob.c:1.3 Tue Jun 4 17:26:06 2002 +++ php4/win32/glob.c Mon Jan 27 11:32:48 2003 @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ -/* $Id: glob.c,v 1.3 2002/06/04 21:26:06 edink Exp $ */ +/* $Id: glob.c,v 1.3.4.1 2003/01/27 16:32:48 edink Exp $ */ /* * glob(3) -- a superset of the one defined in POSIX 1003.2. @@ -99,7 +99,7 @@ #define QUOTE '\\' #define RANGE '-' #define RBRACKET ']' -#define SEP '/' +#define SEP DEFAULT_SLASH #define STAR '*' #define TILDE '~' #define UNDERSCORE '_' @@ -171,6 +171,13 @@ int c; Char *bufnext, *bufend, patbuf[MAXPATHLEN]; +#ifdef PHP_WIN32 + /* Force skipping escape sequences on windows + * due to the ambiguity with path backslashes + */ + flags |= GLOB_NOESCAPE; +#endif + patnext = (u_char *) pattern; if (!(flags & GLOB_APPEND)) { pglob->gl_pathc = 0; @@ -558,7 +565,7 @@ return(0); if (((pglob->gl_flags & GLOB_MARK) && - pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || + !IS_SLASH(pathend[-1])) && (S_ISDIR(sb.st_mode) || (S_ISLNK(sb.st_mode) && (g_stat(pathbuf, &sb, pglob) == 0) && S_ISDIR(sb.st_mode)))) { @@ -574,7 +581,7 @@ /* Find end of next segment, copy tentatively to pathend. */ q = pathend; p = pattern; - while (*p != EOS && *p != SEP) { + while (*p != EOS && !IS_SLASH(*p)) { if (ismeta(*p)) anymeta = 1; if (q+1 > pathend_last) @@ -585,7 +592,7 @@ if (!anymeta) { /* No expansion, do next segment. */ pathend = q; pattern = p; - while (*pattern == SEP) { + while (IS_SLASH(*pattern)) { if (pathend+1 > pathend_last) return (1); *pathend++ = *pattern++; Index: php4/NEWS diff -u php4/NEWS:1.1247.2.51 php4/NEWS:1.1247.2.52 --- php4/NEWS:1.1247.2.51 Fri Jan 24 04:54:30 2003 +++ php4/NEWS Mon Jan 27 11:32:48 2003 @@ -9,6 +9,7 @@ . Disallow linkage of Berkeley db submodules against libraries with different major version. . Disallow configuring of more than one Berkeley db handler. +- Fixed bug #21597 (made glob() understand Windows paths). (Edin) - Fixed bug #20857 (snmpset() failed always, patch by: [EMAIL PROTECTED]). (Jani) - Fixed bug #14532 (fixed connection_status() to return 2 for timeouts). (Jani) - Fixed bug #21525 (bind_textdomain_codeset() now available on Windows). (Edin)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php