Skip to content

Commit

Permalink
fixed filesystem loader when trying to load a non-file
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Feb 16, 2015
1 parent 8e32c50 commit fd6f28b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
@@ -1,6 +1,6 @@
* 1.18.1 (2015-XX-XX)

* n/a
* fixed filesystem loader when trying to load non-files (like directories)

* 1.18.0 (2015-01-25)

Expand Down
7 changes: 4 additions & 3 deletions lib/Twig/Loader/Filesystem.php
Expand Up @@ -183,10 +183,11 @@ protected function findTemplate($name)
}

foreach ($this->paths[$namespace] as $path) {
if (false !== $realpath = realpath($path.'/'.$shortname)) {
return $this->cache[$name] = $realpath;
}
if (is_file($path.'/'.$shortname)) {
if (false !== $realpath = realpath($path.'/'.$shortname)) {
return $this->cache[$name] = $realpath;
}

return $this->cache[$name] = $path.'/'.$shortname;
}
}
Expand Down

0 comments on commit fd6f28b

Please sign in to comment.