From d08ceadf4a1beb71a710e8afd534c0b1e3963f32 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 23 Aug 2015 14:21:39 +0200 Subject: [PATCH] fixed wrong commit --- lib/Twig/Loader/Array.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Twig/Loader/Array.php b/lib/Twig/Loader/Array.php index 56070af06..90221d5db 100644 --- a/lib/Twig/Loader/Array.php +++ b/lib/Twig/Loader/Array.php @@ -23,7 +23,7 @@ */ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface { - private $templates = array(); + protected $templates = array(); /** * Constructor. @@ -43,7 +43,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf */ public function setTemplate($name, $template) { - $this->templates[$name] = $template; + $this->templates[(string) $name] = $template; } /** @@ -51,6 +51,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf */ public function getSource($name) { + $name = (string) $name; if (!isset($this->templates[$name])) { throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); } @@ -63,7 +64,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf */ public function exists($name) { - return isset($this->templates[$name]); + return isset($this->templates[(string) $name]); } /** @@ -71,6 +72,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf */ public function getCacheKey($name) { + $name = (string) $name; if (!isset($this->templates[$name])) { throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); } @@ -83,6 +85,7 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf */ public function isFresh($name, $time) { + $name = (string) $name; if (!isset($this->templates[$name])) { throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); }