pajoye Tue Jan 20 01:41:19 2009 UTC Modified files: /php-src/ext/standard file.c /php-src/ext/standard/tests/file fnmatch_basic.phpt fnmatch_error.phpt fnmatch_variation.phpt Log: - MFB - [DOC] add support for fnmatch() on Windows - enable tests (pass) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.537&r2=1.538&diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.537 php-src/ext/standard/file.c:1.538 --- php-src/ext/standard/file.c:1.537 Fri Jan 9 22:50:45 2009 +++ php-src/ext/standard/file.c Tue Jan 20 01:41:18 2009 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.537 2009/01/09 22:50:45 tony2001 Exp $ */ +/* $Id: file.c,v 1.538 2009/01/20 01:41:18 pajoye Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -48,6 +48,7 @@ #define O_RDONLY _O_RDONLY #include "win32/param.h" #include "win32/winutil.h" +#include "win32/fnmatch.h" #elif defined(NETWARE) #include <sys/param.h> #include <sys/select.h> @@ -115,7 +116,7 @@ php_file_globals file_globals; #endif -#ifdef HAVE_FNMATCH +#if defined(HAVE_FNMATCH) && !defined(PHP_WIN32) #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_basic.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/standard/tests/file/fnmatch_basic.phpt diff -u php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.6 php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.7 --- php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.6 Tue Oct 21 13:38:57 2008 +++ php-src/ext/standard/tests/file/fnmatch_basic.phpt Tue Jan 20 01:41:19 2009 @@ -2,9 +2,6 @@ Test fnmatch() function: Basic functionality --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); - if (!function_exists('fnmatch')) die("skip fnmatch() function is not available"); ?> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_error.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/standard/tests/file/fnmatch_error.phpt diff -u php-src/ext/standard/tests/file/fnmatch_error.phpt:1.6 php-src/ext/standard/tests/file/fnmatch_error.phpt:1.7 --- php-src/ext/standard/tests/file/fnmatch_error.phpt:1.6 Tue Oct 21 13:38:57 2008 +++ php-src/ext/standard/tests/file/fnmatch_error.phpt Tue Jan 20 01:41:19 2009 @@ -2,9 +2,6 @@ Test fnmatch() function: Error conditions --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); - if (!function_exists('fnmatch')) die("skip fnmatch() function is not available"); ?> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_variation.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/standard/tests/file/fnmatch_variation.phpt diff -u php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.6 php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.7 --- php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.6 Tue Oct 21 13:38:57 2008 +++ php-src/ext/standard/tests/file/fnmatch_variation.phpt Tue Jan 20 01:41:19 2009 @@ -2,9 +2,6 @@ Test fnmatch() function: Variations --SKIPIF-- <?php -if (substr(PHP_OS, 0, 3) == 'WIN') - die("skip do not run on Windows"); - if (!function_exists('fnmatch')) die("skip fnmatch() function is not available"); ?> @@ -18,6 +15,11 @@ echo "*** Testing fnmatch() with file and various patterns ***\n"; $file_name = dirname(__FILE__)."/match.tmp"; +/* avoid using \, it breaks the pattern */ +if (substr(PHP_OS, 0, 3) == 'WIN') { + $file_name = str_replace('\\','/', $file_name); +} + fopen($file_name, "w"); $pattern_arr = array(