Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3fa8a1

Browse files
committed
Avoid setting request attributes from signature arguments in AnnotationClassLoader
1 parent 5ba84ca commit d3fa8a1

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
138138
}
139139

140140
$defaults = array_replace($globals['defaults'], $annot->getDefaults());
141-
foreach ($method->getParameters() as $param) {
142-
if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
143-
$defaults[$param->getName()] = $param->getDefaultValue();
144-
}
145-
}
146141
$requirements = array_replace($globals['requirements'], $annot->getRequirements());
147142
$options = array_replace($globals['options'], $annot->getOptions());
148143
$schemes = array_merge($globals['schemes'], $annot->getSchemes());

src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,10 @@ public function testLoad($className, $routeData = array(), $methodArgs = array()
136136
array_intersect_assoc($routeData['options'], $route->getOptions()),
137137
'->load preserves options annotation'
138138
);
139-
$defaults = array_replace($methodArgs, $routeData['defaults']);
140139
$this->assertCount(
141-
count($defaults),
142-
array_intersect_assoc($defaults, $route->getDefaults()),
143-
'->load preserves defaults annotation and merges them with default arguments in method signature'
140+
count($routeData['defaults']),
141+
$route->getDefaults(),
142+
'->load preserves defaults annotation'
144143
);
145144
$this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation');
146145
$this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation');

0 commit comments

Comments
 (0)