[Routing] Disallow object usage inside Route
This commit is contained in:
parent
3f4644b2f1
commit
426fb45cfb
@ -746,6 +746,10 @@ EOF;
|
||||
return 'null';
|
||||
}
|
||||
if (!\is_array($value)) {
|
||||
if (\is_object($value)) {
|
||||
throw new \InvalidArgumentException('Symfony\Component\Routing\Route cannot contain objects.');
|
||||
}
|
||||
|
||||
return str_replace("\n", '\'."\n".\'', var_export($value, true));
|
||||
}
|
||||
if (!$value) {
|
||||
|
@ -491,6 +491,18 @@ class PhpMatcherDumperTest extends TestCase
|
||||
|
||||
return $this->matcherClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Symfony\Component\Routing\Route cannot contain objects
|
||||
*/
|
||||
public function testGenerateDumperMatcherWithObject()
|
||||
{
|
||||
$routeCollection = new RouteCollection();
|
||||
$routeCollection->add('_', new Route('/', array(new \stdClass())));
|
||||
$dumper = new PhpMatcherDumper($routeCollection);
|
||||
$dumper->dump();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface
|
||||
|
Reference in New Issue
Block a user