Skip to content

Commit 92e7fa1

Browse files
committed
[FrameworkBundle] fix routing container param resolving to not access deprecated requirements while maintaining BC
1 parent 6f1e26d commit 92e7fa1

File tree

1 file changed

+20
-2
lines changed
  • src/Symfony/Bundle/FrameworkBundle/Routing

1 file changed

+20
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ public function warmUp($cacheDir)
7777
* Replaces placeholders with service container parameter values in:
7878
* - the route defaults,
7979
* - the route requirements,
80-
* - the route pattern.
81-
* - the route host.
80+
* - the route path,
81+
* - the route host,
82+
* - the route schemes,
83+
* - the route methods.
8284
*
8385
* @param RouteCollection $collection
8486
*/
@@ -90,11 +92,27 @@ private function resolveParameters(RouteCollection $collection)
9092
}
9193

9294
foreach ($route->getRequirements() as $name => $value) {
95+
if ('_scheme' === $name || '_method' === $name) {
96+
continue; // ignore deprecated requirements to not trigger deprecation warnings
97+
}
98+
9399
$route->setRequirement($name, $this->resolve($value));
94100
}
95101

96102
$route->setPath($this->resolve($route->getPath()));
97103
$route->setHost($this->resolve($route->getHost()));
104+
105+
$schemes = array();
106+
foreach ($route->getSchemes() as $scheme) {
107+
$schemes = array_merge($schemes, explode('|', $this->resolve($scheme)));
108+
}
109+
$route->setSchemes($schemes);
110+
111+
$methods = array();
112+
foreach ($route->getMethods() as $method) {
113+
$methods = array_merge($methods, explode('|', $this->resolve($method)));
114+
}
115+
$route->setMethods($methods);
98116
}
99117
}
100118

0 commit comments

Comments
 (0)