Skip to content

Commit 03f1ccc

Browse files
committed
merged branch Herzult/fix/route_defaults_array (PR symfony#5924)
This PR was merged into the 2.1 branch. Commits ------- 208e134 [FrameworkBundle] Router skip defaults resolution for arrays Discussion ---------- [FrameworkBundle] Router skip defaults resolution for arrays The router should not resolve complex defaults/options parameters but it is not the case for arrays. So this small PR simply adds a check for arrays to prevent array-to-string fatal errors with deep array defaults. ``` Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: ~ Todo: ~ License of the code: MIT Documentation PR: ~ ```
2 parents 3d99374 + 208e134 commit 03f1ccc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function resolveString($value)
114114
{
115115
$container = $this->container;
116116

117-
if (null === $value || false === $value || true === $value || is_object($value)) {
117+
if (null === $value || false === $value || true === $value || is_object($value) || is_array($value)) {
118118
return $value;
119119
}
120120

src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function testDefaultValuesAsNonStrings($value)
163163

164164
public function getNonStringValues()
165165
{
166-
return array(array(null), array(false), array(true), array(new \stdClass()), array(array('foo', 'bar')));
166+
return array(array(null), array(false), array(true), array(new \stdClass()), array(array('foo', 'bar')), array(array(array())));
167167
}
168168

169169
private function getServiceContainer(RouteCollection $routes)

0 commit comments

Comments
 (0)