8000 minor #26307 [Routing] Revert throwing 405 on missed slash/scheme red… · dunglas/symfony@d8395f5 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit d8395f5

Browse files
committed
minor symfony#26307 [Routing] Revert throwing 405 on missed slash/scheme redirections (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [Routing] Revert throwing 405 on missed slash/scheme redirections | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | ye | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This partially reverts an unreleased behavior: throwing a 405 when a non-safe verb prevents a slash/scheme redirection. While this was correct, we are removing it from master to remove some complexity from the implementation of dumped router. Better not make anyone rely on such nitpicking details that have little to no use in practice. Commits ------- 391b013 [Routing] Revert throwing 405 on missed slash/scheme redirections
2 parents 25f3eb5 + 391b013 commit d8395f5

File tree

3 files changed

+0
-15
lines changed

3 files changed

+0
-15
lines changed

src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
264264
if ('/' === substr(\$pathinfo, -1)) {
265265
// no-op
266266
} elseif (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
267-
\$allow[] = 'GET';
268267
goto $gotoname;
269268
} else {
270269
return \$this->redirect(\$rawPathinfo.'/', '$name');
@@ -283,7 +282,6 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
283282
\$requiredSchemes = $schemes;
284283
if (!isset(\$requiredSchemes[\$this->context->getScheme()])) {
285284
if (!in_array(\$this->context->getMethod(), array('HEAD', 'GET'))) {
286-
\$allow[] = 'GET';
287285
goto $gotoname;
288286
}
289287

src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public function match($rawPathinfo)
6969
if ('/' === substr($pathinfo, -1)) {
7070
// no-op
7171
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
72-
$allow[] = 'GET';
7372
goto not_baz3;
7473
} else {
7574
return $this->redirect($rawPathinfo.'/', 'baz3');
@@ -86,7 +85,6 @@ public function match($rawPathinfo)
8685
if ('/' === substr($pathinfo, -1)) {
8786
// no-op
8887
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
89-
$allow[] = 'GET';
9088
goto not_baz4;
9189
} else {
9290
return $this->redirect($rawPathinfo.'/', 'baz4');
@@ -185,7 +183,6 @@ public function match($rawPathinfo)
185183
if ('/' === substr($pathinfo, -1)) {
186184
// no-op
187185
} elseif (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
188-
$allow[] = 'GET';
189186
goto not_hey;
190187
} else {
191188
return $this->redirect($rawPathinfo.'/', 'hey');
@@ -337,7 +334,6 @@ public function match($rawPathinfo)
337334
$requiredSchemes = array ( 'https' => 0,);
338335
if (!isset($requiredSchemes[$this->context->getScheme()])) {
339336
if (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
340-
$allow[] = 'GET';
341337
goto not_secure;
342338
}
343339

@@ -353,7 +349,6 @@ public function match($rawPathinfo)
353349
$requiredSchemes = array ( 'http' => 0,);
354350
if (!isset($requiredSchemes[$this->context->getScheme()])) {
355351
if (!in_array($this->context->getMethod(), array('HEAD', 'GET'))) {
356-
$allow[] = 'GET';
357352
goto not_nonsecure;
358353
}
359354

src/Symfony/Component/Routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@
1919

2020
class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
2121
{
22-
/**
23-
* @expectedException \Symfony\Component\Routing\Exception\MethodNotAllowedException
24-
*/
25-
public function testRedirectWhenNoSlashForNonSafeMethod()
26-
{
27-
parent::testRedirectWhenNoSlashForNonSafeMethod();
28-
}
29-
3022
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
3123
{
3224
static $i = 0;

0 commit comments

Comments
 (0)
0