$compiler->write("\$context = \$this->env->getGlobals();\n\n");
} else {
$compiler
- ->write("\$context = array_merge(\$this->env->getGlobals(), array(\n")
+ ->write("\$context = \$this->mergeContextWithGlobals(array(\n")
->indent()
;
--CONFIG--
return array('debug' => true, 'autoescape' => false);
--EXPECT--
-array(2) {
+array(3) {
["foo"]=>
string(3) "foo"
["bar"]=>
string(3) "bar"
+ ["global"]=>
+ string(6) "global"
}
string(3) "foo"
--DATA--
return array('foo' => 'bar')
--EXPECT--
-foo,_parent,
-_parent,
-foo,foo1,_parent,
-foo1,_parent,
+foo,global,_parent,
+global,_parent,
+foo,global,foo1,_parent,
+foo1,global,_parent,
array($node, <<<EOF
public function getfoo(\$foo = null)
{
- \$context = array_merge(\$this->env->getGlobals(), array(
+ \$context = \$this->mergeContextWithGlobals(array(
"foo" => \$foo,
));
$twig->addExtension(new Twig_Extension_Debug());
$policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(), array(), array());
$twig->addExtension(new Twig_Extension_Sandbox($policy, false));
+ $twig->addGlobal('global', 'global');
try {
$template = $twig->loadTemplate('index.twig');