10000 [TwigBundle] made error message more explicit · ruudk/symfony@2ae5427 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ae5427

Browse files
committed
[TwigBundle] made error message more explicit
1 parent e2ea634 commit 2ae5427

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,23 @@ public function isFresh($name, $time)
7575

7676
protected function findTemplate($name)
7777
{
78-
if (!is_array($name)) {
79-
$name = $this->parser->parse($name);
80-
}
78+
$tpl = is_array($name) ? $name : $this->parser->parse($name);
8179

82-
$key = md5(serialize($name));
80+
$key = md5(serialize($tpl));
8381
if (isset($this->cache[$key])) {
8482
return $this->cache[$key];
8583
}
8684

8785
$file = null;
8886
$previous = null;
8987
try {
90-
$file = $this->locator->locate($name);
88+
$file = $this->locator->locate($tpl);
9189
} catch (\InvalidArgumentException $e) {
9290
$previous = $e;
9391
}
9492

9593
if (false === $file || null === $file) {
96-
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name), 0, null, $previous);
94+
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', json_encode($name)), 0, null, $previous);
9795
}
9896

9997
return $this->cache[$key] = $file;

0 commit comments

Comments
 (0)
0