[Routing] dont redirect routes with greedy trailing vars with no explicit slash
This commit is contained in:
parent
78c23c7838
commit
2bb8890bbb
@ -558,34 +558,27 @@ EOF;
|
|||||||
$code = '';
|
$code = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$code .= $hasVars ? '
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
|
||||||
break;
|
|
||||||
}' : '
|
|
||||||
break;';
|
|
||||||
|
|
||||||
$code = sprintf(<<<'EOF'
|
$code = sprintf(<<<'EOF'
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {%s
|
if ('/' !== $pathinfo && %s$hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {%s
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
,
|
,
|
||||||
|
$hasVars ? '!$hasTrailingVar && ' : '',
|
||||||
$code
|
$code
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($hasVars) {
|
if ($hasVars) {
|
||||||
$code = <<<'EOF'
|
$code = <<<'EOF'
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
.$code.<<<'EOF'
|
.$code.<<<'EOF'
|
||||||
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
|
$matches = $n;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
if (isset($matches[1 + $i])) {
|
if (isset($matches[1 + $i])) {
|
||||||
@ -665,31 +658,10 @@ EOF
|
|||||||
if ('/' !== $pathinfo && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
if ('/' !== $pathinfo && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
$matches = $n;
|
$matches = $n;
|
||||||
}
|
}
|
||||||
EOF;
|
|
||||||
} elseif ($this->supportsRedirections && (!$methods || isset($methods['GET']))) {
|
|
||||||
$code .= <<<'EOF'
|
|
||||||
$hasTrailingSlash = false;
|
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {%s
|
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
|
||||||
goto %s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF;
|
EOF;
|
||||||
} else {
|
} else {
|
||||||
$code .= <<<'EOF'
|
$code .= <<<'EOF'
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto %2$s;
|
goto %2$s;
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
|
@ -156,21 +156,18 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar = preg_match('#\{\w+\}/?$#', $route->getPath())) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && preg_match('#\{\w+\}/?$#', $route->getPath());
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, $trimmedPathinfo, $m)) {
|
|
||||||
$matches = $m;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
|
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) {
|
||||||
return $this->allow = $this->allowSchemes = [];
|
return $this->allow = $this->allowSchemes = [];
|
||||||
}
|
}
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, $trimmedPathinfo, $m)) {
|
||||||
|
$matches = $m;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hostMatches = [];
|
$hostMatches = [];
|
||||||
|
@ -187,11 +187,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
break;
|
break;
|
||||||
case 160:
|
case 160:
|
||||||
// foo1
|
// foo1
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto not_foo1;
|
goto not_foo1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,11 +205,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
break;
|
break;
|
||||||
case 204:
|
case 204:
|
||||||
// foo2
|
// foo2
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto not_foo2;
|
goto not_foo2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,11 +217,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
break;
|
break;
|
||||||
case 279:
|
case 279:
|
||||||
// foo3
|
// foo3
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto not_foo3;
|
goto not_foo3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,17 +250,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
break;
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
}
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$matches = $n;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -2794,17 +2794,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
break;
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
}
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$matches = $n;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -119,20 +119,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
|
||||||
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
||||||
return $allow = $allowSchemes = [];
|
return $allow = $allowSchemes = [];
|
||||||
}
|
}
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
|
$matches = $n;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -64,17 +64,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
break;
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
}
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$matches = $n;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -44,11 +44,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
switch ($m = (int) $matches['MARK']) {
|
switch ($m = (int) $matches['MARK']) {
|
||||||
case 56:
|
case 56:
|
||||||
// r1
|
// r1
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto not_r1;
|
goto not_r1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,11 +54,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
not_r1:
|
not_r1:
|
||||||
|
|
||||||
// r2
|
// r2
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto not_r2;
|
goto not_r2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,11 +230,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
break;
|
break;
|
||||||
case 160:
|
case 160:
|
||||||
// foo1
|
// foo1
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} elseif ('/' !== $pathinfo) {
|
|
||||||
goto not_foo1;
|
goto not_foo1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,22 +248,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
break;
|
break;
|
||||||
case 204:
|
case 204:
|
||||||
// foo2
|
// foo2
|
||||||
$hasTrailingSlash = false;
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
goto not_foo2;
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
|
||||||
if ('GET' === $canonicalMethod) {
|
|
||||||
return $allow = $allowSchemes = [];
|
|
||||||
}
|
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
|
||||||
goto not_foo2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches = ['foo1' => $matches[1] ?? null];
|
$matches = ['foo1' => $matches[1] ?? null];
|
||||||
@ -278,22 +260,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
break;
|
break;
|
||||||
case 279:
|
case 279:
|
||||||
// foo3
|
// foo3
|
||||||
$hasTrailingSlash = false;
|
if ($trimmedPathinfo !== $pathinfo) {
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
goto not_foo3;
|
||||||
// no-op
|
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
|
||||||
if ('GET' === $canonicalMethod) {
|
|
||||||
return $allow = $allowSchemes = [];
|
|
||||||
}
|
|
||||||
if ($trimmedPathinfo === $pathinfo) {
|
|
||||||
goto not_foo3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$matches = ['_locale' => $matches[1] ?? null, 'foo' => $matches[2] ?? null];
|
$matches = ['_locale' => $matches[1] ?? null, 'foo' => $matches[2] ?? null];
|
||||||
@ -325,20 +293,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
|
||||||
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
||||||
return $allow = $allowSchemes = [];
|
return $allow = $allowSchemes = [];
|
||||||
}
|
}
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
|
$matches = $n;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -84,17 +84,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
break;
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
}
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$matches = $n;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -124,20 +124,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
|
||||||
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
||||||
return $allow = $allowSchemes = [];
|
return $allow = $allowSchemes = [];
|
||||||
}
|
}
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
|
$matches = $n;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -98,17 +98,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
break;
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
}
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$matches = $n;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -136,20 +136,15 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
|
||||||
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
if ('GET' === $canonicalMethod && (!$requiredMethods || isset($requiredMethods['GET']))) {
|
||||||
return $allow = $allowSchemes = [];
|
return $allow = $allowSchemes = [];
|
||||||
}
|
}
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
|
$matches = $n;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
@ -52,17 +52,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
|
|||||||
|
|
||||||
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
list($ret, $vars, $requiredMethods, $requiredSchemes, $hasTrailingSlash, $hasTrailingVar) = $routes[$m];
|
||||||
|
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$hasTrailingVar = $trimmedPathinfo !== $pathinfo && $hasTrailingVar;
|
||||||
// no-op
|
if ('/' !== $pathinfo && !$hasTrailingVar && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
||||||
} elseif (preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
break;
|
||||||
$matches = $n;
|
|
||||||
} else {
|
|
||||||
$hasTrailingSlash = true;
|
|
||||||
}
|
}
|
||||||
if ('/' !== $pathinfo && $hasTrailingSlash === ($trimmedPathinfo === $pathinfo)) {
|
if ($hasTrailingSlash && $hasTrailingVar && preg_match($regex, rtrim($matchedPathinfo, '/') ?: '/', $n) && $m === (int) $n['MARK']) {
|
||||||
if ($trimmedPathinfo === $pathinfo || !$hasTrailingVar) {
|
$matches = $n;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vars as $i => $v) {
|
foreach ($vars as $i => $v) {
|
||||||
|
Reference in New Issue
Block a user