Skip to content

Commit 3ec9005

Browse files
committed
[Templating] fixed misnamed variable that caused some double-rendering problems
1 parent 7dc5ae3 commit 3ec9005

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Symfony/Components/Templating/Engine.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ public function __construct(LoaderInterface $loader, array $renderers = array(),
8282
public function render($name, array $parameters = array())
8383
{
8484
if (isset($this->cache[$name])) {
85-
list($name, $options, $template) = $this->cache[$name];
85+
list($tpl, $options, $template) = $this->cache[$name];
8686
} else {
87-
list($name, $options) = $this->splitTemplateName($old = $name);
87+
list($tpl, $options) = $this->splitTemplateName($name);
8888

8989
// load
90-
$template = $this->loader->load($name, $options);
90+
$template = $this->loader->load($tpl, $options);
9191

9292
if (false === $template) {
9393
throw new \InvalidArgumentException(sprintf('The template "%s" does not exist (renderer: %s).', $name, $options['renderer']));
9494
}
9595

96-
$this->cache[$old] = array($name, $options, $template);
96+
$this->cache[$name] = array($tpl, $options, $template);
9797
}
9898

9999
$this->current = $name;

tests/Symfony/Tests/Components/Templating/EngineTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function testExtendRender()
9999
$this->fail('->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
100100
} catch (\Exception $e) {
101101
$this->assertInstanceOf('\InvalidArgumentException', $e, '->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
102-
$this->assertEquals('The template "foo" does not exist (renderer: name).', $e->getMessage(), '->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
102+
$this->assertEquals('The template "foo:name" does not exist (renderer: name).', $e->getMessage(), '->render() throws an InvalidArgumentException if no renderer is registered for the given renderer');
103103
}
104104

105105
$engine = new ProjectTemplateEngine(self::$loader, array(), array(new SlotsHelper()));

0 commit comments

Comments
 (0)