mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 15:07:11 +00:00
fixed the "with" behavior to always include the globals
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.39.0 (2019-XX-XX)
|
||||
|
||||
* fixed the "with" behavior to always include the globals (for consistency with the "include" and "embed" tags)
|
||||
* fixed "include" with "ignore missing" when an error loading occurs in the included template
|
||||
* added support for a new whitespace trimming option ({%~ ~%}, {{~ ~}}, {#~ ~#})
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class WithNode extends Node
|
||||
$compiler->write("\$context['_parent'] = \$context;\n");
|
||||
}
|
||||
|
||||
$compiler->write(sprintf("\$context = array_merge(\$context, \$%s);\n", $varsName));
|
||||
$compiler->write(sprintf("\$context = \$this->env->mergeGlobals(array_merge(\$context, \$%s));\n", $varsName));
|
||||
} else {
|
||||
$compiler->write("\$context['_parent'] = \$context;\n");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
"with" tag
|
||||
--TEMPLATE--
|
||||
{% with [] only %}
|
||||
{{ global }}
|
||||
{% endwith %}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
global
|
||||
Reference in New Issue
Block a user