-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Fixed unexpected 404 NoConfigurationException #31207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ public function match($pathinfo) | |
return $ret; | ||
} | ||
|
||
if ('/' === $pathinfo && !$this->allow) { | ||
if ('/' === $pathinfo && !$this->allow && !$this->allowSchemes) { | ||
throw new NoConfigurationException(); | ||
} | ||
|
||
|
@@ -182,24 +182,16 @@ protected function matchCollection($pathinfo, RouteCollection $routes) | |
if ($supportsTrailingSlash && (!$requiredMethods || \in_array('GET', $requiredMethods))) { | ||
return $this->allow = $this->allowSchemes = []; | ||
} | ||
|
||
continue; | ||
} | ||
|
||
$hasRequiredScheme = !$route->getSchemes() || $route->hasScheme($this->context->getScheme()); | ||
if ($requiredMethods) { | ||
if (!\in_array($method, $requiredMethods)) { | ||
if ($hasRequiredScheme) { | ||
$this->allow = array_merge($this->allow, $requiredMethods); | ||
} | ||
|
||
continue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this |
||
} | ||
} | ||
|
||
if (!$hasRequiredScheme) { | ||
if ($route->getSchemes() && !$route->hasScheme($this->context->getScheme())) { | ||
$this->allowSchemes = array_merge($this->allowSchemes, $route->getSchemes()); | ||
continue; | ||
} | ||
|
||
if ($requiredMethods && !\in_array($method, $requiredMethods)) { | ||
$this->allow = array_merge($this->allow, $requiredMethods); | ||
continue; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -727,6 +727,7 @@ public function testNestedCollections() | |
|
||
/** | ||
* @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException | ||
* @expectedExceptionMessage No routes found for "/". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making sure it is a |
||
*/ | ||
public function testSchemeAndMethodMismatch() | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to what we have in
PhpMatcherTrait
:symfony/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherTrait.php
Lines 176 to 178 in e479b69