Skip to content

Commit

Permalink
Merge pull request #165 from peterrehm/fs-loader
Browse files Browse the repository at this point in the history
Bugfix FS Loader
  • Loading branch information
lsmith77 committed Jan 27, 2017
2 parents 685e4f3 + 703ec21 commit d82ac64
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Twig/Loader/FilesystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ protected function findTemplate($template, $throw = true)

$file = null;
$previous = null;

try {
$file = parent::findTemplate((string) $template);
} catch (\Twig_Error_Loader $e) {
$template = $this->parser->parse($template);
$file = $this->locator->locate($template);
} catch (\Exception $e) {
$previous = $e;

// for BC
try {
$template = $this->parser->parse($template);
$file = $this->locator->locate($template);
} catch (\Exception $e) {
$file = parent::findTemplate((string) $template);
} catch (\Twig_Error_Loader $e) {
$previous = $e;
}
}
Expand Down

0 comments on commit d82ac64

Please sign in to comment.