8000 [Templating] fixed PhpEngine::render() when the name passed to it is … · alexfilatov/symfony@5d963f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d963f5

Browse files
committed
[Templating] fixed PhpEngine::render() when the name passed to it is already an array
1 parent db2f2b1 commit 5d963f5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Symfony/Component/Templating/PhpEngine.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,26 @@ public function render($name, array $parameters = array())
7575
{
7676
$template = $this->load($name);
7777

78-
$this->current = $name;
79-
$this->parents[$name] = null;
78+
$key = md5(serialize($template));
79+
80+
$this->current = $key;
81+
$this->parents[$key] = null;
8082

8183
// attach the global variables
8284
$parameters = array_replace($this->getGlobals(), $parameters);
8385

8486
// render
8587
if (false === $content = $this->evaluate($template, $parameters)) {
86-
throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', $name));
88+
throw new \RuntimeException(sprintf('The template "%s" cannot be rendered.', var_export($template, true)));
8789
}
8890

8991
// decorator
90-
if ($this->parents[$name]) {
92+
if ($this->parents[$key]) {
9193
$slots = $this->get('slots');
9294
$this->stack[] = $slots->get('_content');
9395
$slots->set('_content', $content);
9496

95-
$content = $this->render($this->parents[$name], $parameters);
97+
$content = $this->render($this->parents[$key], $parameters);
9698

9799
$slots->set('_content', array_pop($this->stack));
98100
}

0 commit comments

Comments
 (0)
0