merged branch Herzult/fix/route_defaults_array (PR #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: ~
```
This commit is contained in:
Fabien Potencier 2012-11-07 07:47:25 +01:00
commit 03f1ccc956
2 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ class Router extends BaseRouter implements WarmableInterface
{
$container = $this->container;
if (null === $value || false === $value || true === $value || is_object($value)) {
if (null === $value || false === $value || true === $value || is_object($value) || is_array($value)) {
return $value;
}

View File

@ -163,7 +163,7 @@ class RoutingTest extends \PHPUnit_Framework_TestCase
public function getNonStringValues()
{
return array(array(null), array(false), array(true), array(new \stdClass()), array(array('foo', 'bar')));
return array(array(null), array(false), array(true), array(new \stdClass()), array(array('foo', 'bar')), array(array(array())));
}
private function getServiceContainer(RouteCollection $routes)