Skip to content

Commit

Permalink
[HttpKernel] Arrays with scalar values passed to ESI fragment rendere…
Browse files Browse the repository at this point in the history
…r throw deprecation notice
  • Loading branch information
Amrouche Hamza committed Nov 29, 2017
1 parent 020d78a commit d84b47f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Expand Up @@ -98,8 +98,8 @@ private function generateSignedFragmentUri($uri, Request $request)
private function containsNonScalars(array $values)
{
foreach ($values as $value) {
if (is_array($value) && $this->containsNonScalars($value)) {
return true;
if (is_array($value)) {
return $this->containsNonScalars($value);
} elseif (!is_scalar($value) && null !== $value) {
return true;
}
Expand Down
Expand Up @@ -34,7 +34,15 @@ public function testRenderFallbackWithObjectAttributesIsDeprecated()
{
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
$request = Request::create('/');
$reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array());
$reference = new ControllerReference('main_controller', array('foo' => new \stdClass()), array());
$strategy->render($reference, $request);
}

public function testRenderFallbackWithScalarIsNotDeprecated()
{
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
$request = Request::create('/');
$reference = new ControllerReference('main_controller', array('foo' => array(true)), array());
$strategy->render($reference, $request);
}

Expand Down

0 comments on commit d84b47f

Please sign in to comment.