Merge branch '1.x' into 2.x

* 1.x:
  fixed the "with" behavior to always include the globals
This commit is contained in:
Fabien Potencier
2019-04-11 09:38:25 +02:00
3 changed files with 12 additions and 1 deletions
+1
View File
@@ -194,6 +194,7 @@
* 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 ({%~ ~%}, {{~ ~}}, {#~ ~#})
+1 -1
View File
@@ -56,7 +56,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