pajoye Tue Jan 20 01:40:07 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c /php-src/ext/standard/tests/file fnmatch_basic.phpt fnmatch_error.phpt fnmatch_variation.phpt Log: - [DOC] add support for fnmatch() on Windows - enable tests (pass) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.28&r2=1.409.2.6.2.28.2.29&diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.28 php-src/ext/standard/file.c:1.409.2.6.2.28.2.29 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.28 Wed Dec 31 11:15:45 2008 +++ php-src/ext/standard/file.c Tue Jan 20 01:40:05 2009 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.28 2008/12/31 11:15:45 sebastian Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.29 2009/01/20 01:40:05 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> @@ -116,7 +117,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.1.2.2.2.2&r2=1.1.2.2.2.3&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.1.2.2.2.2 php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.1.2.2.2.3 --- php-src/ext/standard/tests/file/fnmatch_basic.phpt:1.1.2.2.2.2 Tue Oct 21 13:38:18 2008 +++ php-src/ext/standard/tests/file/fnmatch_basic.phpt Tue Jan 20 01:40:06 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"); ?> @@ -34,7 +31,7 @@ echo "\n*** Done ***\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file *** bool(true) bool(true) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fnmatch_error.phpt?r1=1.1.2.2.2.3&r2=1.1.2.2.2.4&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.1.2.2.2.3 php-src/ext/standard/tests/file/fnmatch_error.phpt:1.1.2.2.2.4 --- php-src/ext/standard/tests/file/fnmatch_error.phpt:1.1.2.2.2.3 Tue Oct 21 13:38:18 2008 +++ php-src/ext/standard/tests/file/fnmatch_error.phpt Tue Jan 20 01:40:06 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.1.2.2.2.3&r2=1.1.2.2.2.4&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.1.2.2.2.3 php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.1.2.2.2.4 --- php-src/ext/standard/tests/file/fnmatch_variation.phpt:1.1.2.2.2.3 Tue Oct 21 13:38:18 2008 +++ php-src/ext/standard/tests/file/fnmatch_variation.phpt Tue Jan 20 01:40:06 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( @@ -132,7 +134,7 @@ echo "\n*** Done ***\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fnmatch() with file and various patterns *** -- Iteration 0 -- bool(true)