summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-01-20 01:40:06 +0000
committerPierre Joye <pajoye@php.net>2009-01-20 01:40:06 +0000
commitd0c201d3f462367f87f1211dc4fc6f35c21af876 (patch)
treeb2d1890f1ce6b960604627f8a566ac2db77704f7
parentf8aff4ad073390933f44057dea32fa8e6db6f5eb (diff)
downloadphp-git-d0c201d3f462367f87f1211dc4fc6f35c21af876.tar.gz
- [DOC] add support for fnmatch() on Windows
- enable tests (pass)
-rw-r--r--ext/standard/file.c3
-rw-r--r--ext/standard/tests/file/fnmatch_basic.phpt5
-rw-r--r--ext/standard/tests/file/fnmatch_error.phpt3
-rw-r--r--ext/standard/tests/file/fnmatch_variation.phpt10
4 files changed, 9 insertions, 12 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index d5507ab9a0..192d7f1cc2 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -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
diff --git a/ext/standard/tests/file/fnmatch_basic.phpt b/ext/standard/tests/file/fnmatch_basic.phpt
index 4eb567c392..189605169d 100644
--- a/ext/standard/tests/file/fnmatch_basic.phpt
+++ b/ext/standard/tests/file/fnmatch_basic.phpt
@@ -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)
diff --git a/ext/standard/tests/file/fnmatch_error.phpt b/ext/standard/tests/file/fnmatch_error.phpt
index d139064115..6afbe05dcc 100644
--- a/ext/standard/tests/file/fnmatch_error.phpt
+++ b/ext/standard/tests/file/fnmatch_error.phpt
@@ -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");
?>
diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt
index 0e82e37430..e65bdd0555 100644
--- a/ext/standard/tests/file/fnmatch_variation.phpt
+++ b/ext/standard/tests/file/fnmatch_variation.phpt
@@ -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)