]> granicus.if.org Git - php/commitdiff
- [DOC] add support for fnmatch() on Windows
authorPierre Joye <pajoye@php.net>
Tue, 20 Jan 2009 01:40:06 +0000 (01:40 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 20 Jan 2009 01:40:06 +0000 (01:40 +0000)
- enable tests (pass)

ext/standard/file.c
ext/standard/tests/file/fnmatch_basic.phpt
ext/standard/tests/file/fnmatch_error.phpt
ext/standard/tests/file/fnmatch_variation.phpt

index d5507ab9a09f227d3ccf16d20c487c6aa2222b9d..192d7f1cc27b6318913d4feae9682760fcc73cc0 100644 (file)
@@ -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 @@ int file_globals_id;
 php_file_globals file_globals;
 #endif
 
-#ifdef HAVE_FNMATCH
+#if defined(HAVE_FNMATCH) && !defined(PHP_WIN32)
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
index 4eb567c3923116ef97614c8994309f913edf5f0e..189605169d17e4e48b61f6db3bea96422968a1b5 100644 (file)
@@ -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 @@ var_dump( fnmatch(NULL, NULL) );
 
 echo "\n*** Done ***\n";
 ?>
---EXPECTF--
+--EXPECT--
 *** Testing fnmatch() with file ***
 bool(true)
 bool(true)
index d1390641159623cd7f432cfe6d8f35c91cfb8eaa..6afbe05dcc5d2f303f39c485501e741bc5b170cc 100644 (file)
@@ -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");
 ?>
index 0e82e37430c3e3d4adb3ed28efd77e2507d07c53..e65bdd05553868eae86e5d7ab8ec2aba96ac60ad 100644 (file)
@@ -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 @@ if (!function_exists('fnmatch'))
 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 @@ match($null_arr, $null_arr);
 
 echo "\n*** Done ***\n";
 ?>
---EXPECTF--
+--EXPECT--
 *** Testing fnmatch() with file and various patterns ***
 -- Iteration 0 --
 bool(true)