From c819d84d695fea89f49815cedf90093e532d2bee Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 23 Jan 2012 09:41:28 +0100 Subject: [PATCH] Revert "[FrameworkBundle] removed the possibility to pass a non-scalar attributes when calling render() to make the call works with or without a reverse proxy (closes #2941)" This reverts commit 254e49b47cd6c6b9ce4edd3b6a1e0ecbbfc784df. --- CHANGELOG-2.1.md | 1 - src/Symfony/Bundle/FrameworkBundle/HttpKernel.php | 8 -------- .../Bundle/FrameworkBundle/Tests/HttpKernelTest.php | 13 ------------- 3 files changed, 22 deletions(-) diff --git a/CHANGELOG-2.1.md b/CHANGELOG-2.1.md index 75eaf8e12a..9dd5555796 100644 --- a/CHANGELOG-2.1.md +++ b/CHANGELOG-2.1.md @@ -32,7 +32,6 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c ### FrameworkBundle - * [BC BREAK] removed the possibility to pass a non-scalar attributes when calling render() to make the call works with or without a reverse proxy * added a router:match command * added kernel.event_subscriber tag * added a way to create relative symlinks when running assets:install command (--relative option) diff --git a/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php b/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php index bfa22d5389..0ab5634e81 100644 --- a/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php @@ -106,14 +106,6 @@ class HttpKernel extends BaseHttpKernel 'comment' => '', ), $options); - // enforce all attribute values to be scalars to be sure that the same - // render() call will work with or without a reverse proxy - foreach ($options['attributes'] as $key => $value) { - if (!is_scalar($value)) { - throw new \InvalidArgumentException(sprintf('Unable to render the "%s" controller as the "%s" attribute is not a scalar.', $controller, $key)); - } - } - if (!is_array($options['alt'])) { $options['alt'] = array($options['alt']); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php index b0379b2603..e3eddc5d85 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php @@ -219,17 +219,4 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Foo', ob_get_clean()); } - - /** - * @expectedException \InvalidArgumentException - */ - public function testRenderOnlyAllowScalarAttributes() - { - $dispatcher = new EventDispatcher(); - $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); - $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $kernel = new HttpKernel($dispatcher, $container, $resolver); - - $kernel->render('/', array('attributes' => array('foo' => new \stdClass()))); - } }