From: Andrew Winter Date: Fri, 12 Apr 2013 01:57:33 +0000 (+0900) Subject: Prevent extensions from clobbering all globals. X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=7c8acf712e46fa3df8d83514be3d67e9b7635455;p=web%2Fkonrad%2Ftwig.git Prevent extensions from clobbering all globals. --- diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index ff089c2..32b026a 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -1099,7 +1099,12 @@ class Twig_Environment { $globals = array(); foreach ($this->extensions as $extension) { - $globals = array_merge($globals, $extension->getGlobals()); + $extGlob = $extension->getGlobals(); + if (!is_array($extGlob)) { + throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension))); + } + + $globals = array_merge($globals, $extGlob); } return array_merge($globals, $this->staging->getGlobals());