Skip to content

Commit 66e0ed7

Browse files
committed
Change to use / in all cases; was breaking for windows.
1 parent 3b79a9c commit 66e0ed7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/dflydev/util/antPathMatcher/AntPathMatcher.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AntPathMatcher implements IAntPathMatcher
2525
*/
2626
public function isPattern($path)
2727
{
28-
return strstr($path, '*') !== false or strstr($path, '?') !== false or DIRECTORY_SEPARATOR == substr($path, '-1');
28+
return strstr($path, '*') !== false or strstr($path, '?') !== false or '/' == substr($path, '-1');
2929
}
3030

3131
/**
@@ -56,10 +56,10 @@ public function matchStart($pattern, $path)
5656
protected function doMatch($pattern, $path, $fullMatch)
5757
{
5858

59-
if (($pattern[0] == DIRECTORY_SEPARATOR) != ($path[0] == DIRECTORY_SEPARATOR)) {
59+
if (($pattern[0] == '/') != ($path[0] == '/')) {
6060
return false;
6161
}
62-
if (DIRECTORY_SEPARATOR == substr($pattern, '-1')) {
62+
if ('/' == substr($pattern, '-1')) {
6363
$pattern .= '**';
6464
}
6565

@@ -87,13 +87,13 @@ protected function doMatch($pattern, $path, $fullMatch)
8787
if ($pathIdxStart > $pathIdxEnd) {
8888
// Path is exhausted, only match if rest of pattern is * or **'s
8989
if ($pattIdxStart > $pattIdxEnd) {
90-
return (DIRECTORY_SEPARATOR == substr($pattern, '-1') ? DIRECTORY_SEPARATOR == substr($path, '-1') :
91-
!(DIRECTORY_SEPARATOR == substr($path, '-1')));
90+
return ('/' == substr($pattern, '-1') ? '/' == substr($path, '-1') :
91+
!('/' == substr($path, '-1')));
9292
}
9393
if (!$fullMatch) {
9494
return true;
9595
}
96-
if ($pattIdxStart == $pattIdxEnd and '*' == $pattDirs[$pattIdxStart] and DIRECTORY_SEPARATOR == substr($path, -1)) {
96+
if ($pattIdxStart == $pattIdxEnd and '*' == $pattDirs[$pattIdxStart] and '/' == substr($path, -1)) {
9797
return true;
9898
}
9999
for ($i = $pattIdxStart; $i <= $pattIdxEnd; $i++) {
@@ -185,7 +185,7 @@ protected function doMatch($pattern, $path, $fullMatch)
185185

186186
}
187187

188-
protected function tokenizeToStringArray($str, $delimiter = DIRECTORY_SEPARATOR, $trimTokens = true, $ignoreEmptyTokens = true)
188+
protected function tokenizeToStringArray($str, $delimiter = '/', $trimTokens = true, $ignoreEmptyTokens = true)
189189
{
190190
if ($str === null) { return null; }
191191
$tokens = array();

0 commit comments

Comments
 (0)