[FrameworkBundle] fix routing container param resolving to not access deprecated requirements while maintaining BC
This commit is contained in:
parent
bd91867225
commit
9af0ff2fb2
@ -77,8 +77,10 @@ class Router extends BaseRouter implements WarmableInterface
|
|||||||
* Replaces placeholders with service container parameter values in:
|
* Replaces placeholders with service container parameter values in:
|
||||||
* - the route defaults,
|
* - the route defaults,
|
||||||
* - the route requirements,
|
* - the route requirements,
|
||||||
* - the route pattern.
|
* - the route path,
|
||||||
* - the route host.
|
* - the route host,
|
||||||
|
* - the route schemes,
|
||||||
|
* - the route methods.
|
||||||
*
|
*
|
||||||
* @param RouteCollection $collection
|
* @param RouteCollection $collection
|
||||||
*/
|
*/
|
||||||
@ -90,11 +92,27 @@ class Router extends BaseRouter implements WarmableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($route->getRequirements() as $name => $value) {
|
foreach ($route->getRequirements() as $name => $value) {
|
||||||
|
if ('_scheme' === $name || '_method' === $name) {
|
||||||
|
continue; // ignore deprecated requirements to not trigger deprecation warnings
|
||||||
|
}
|
||||||
|
|
||||||
$route->setRequirement($name, $this->resolve($value));
|
$route->setRequirement($name, $this->resolve($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
$route->setPath($this->resolve($route->getPath()));
|
$route->setPath($this->resolve($route->getPath()));
|
||||||
$route->setHost($this->resolve($route->getHost()));
|
$route->setHost($this->resolve($route->getHost()));
|
||||||
|
|
||||||
|
$schemes = array();
|
||||||
|
foreach ($route->getSchemes() as $scheme) {
|
||||||
|
$schemes = array_merge($schemes, explode('|', $this->resolve($scheme)));
|
||||||
|
}
|
||||||
|
$route->setSchemes($schemes);
|
||||||
|
|
||||||
|
$methods = array();
|
||||||
|
foreach ($route->getMethods() as $method) {
|
||||||
|
$methods = array_merge($methods, explode('|', $this->resolve($method)));
|
||||||
|
}
|
||||||
|
$route->setMethods($methods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user