mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
Prevent extensions from clobbering all globals.
This commit is contained in:
committed by
Fabien Potencier
parent
1819d97520
commit
7c8acf712e
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user