From: Jeremy Marc Date: Fri, 26 Oct 2012 22:30:04 +0000 (-0700) Subject: cast $name to string ($name can be an object implementing __toString function) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c5d351dcd27867db1b6d7f995b081eb0b61110ca;p=web%2Fkonrad%2Ftwig.git cast $name to string ($name can be an object implementing __toString function) --- diff --git a/lib/Twig/Loader/Chain.php b/lib/Twig/Loader/Chain.php index 1ab1853..da61aca 100644 --- a/lib/Twig/Loader/Chain.php +++ b/lib/Twig/Loader/Chain.php @@ -70,6 +70,8 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf */ public function exists($name) { + $name = (string) $name; + if (isset($this->hasSourceCache[$name])) { return $this->hasSourceCache[$name]; } diff --git a/lib/Twig/Loader/Filesystem.php b/lib/Twig/Loader/Filesystem.php index b201428..8748e3d 100644 --- a/lib/Twig/Loader/Filesystem.php +++ b/lib/Twig/Loader/Filesystem.php @@ -139,6 +139,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI */ public function exists($name) { + $name = (string) $name; if (isset($this->cache[$name])) { return true; } @@ -162,6 +163,8 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI protected function findTemplate($name) { + $name = (string) $name; + // normalize name $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));