mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
Fix Parser context push on stack
This commit is contained in:
committed by
Fabien Potencier
parent
db93842e80
commit
07ebdfef4d
+6
-1
@@ -63,7 +63,12 @@ class Twig_Parser implements Twig_ParserInterface
|
|||||||
public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false)
|
public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false)
|
||||||
{
|
{
|
||||||
// push all variables into the stack to keep the current state of the parser
|
// push all variables into the stack to keep the current state of the parser
|
||||||
$vars = get_object_vars($this);
|
// using get_object_vars() instead of foreach would lead to https://bugs.php.net/71336
|
||||||
|
$vars = array();
|
||||||
|
foreach ($this as $k => $v) {
|
||||||
|
$vars[$k] = $v;
|
||||||
|
}
|
||||||
|
|
||||||
unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']);
|
unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']);
|
||||||
$this->stack[] = $vars;
|
$this->stack[] = $vars;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
block1extended
|
block1extended
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
|
{{ parent() }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
--TEMPLATE(base.twig)--
|
--TEMPLATE(base.twig)--
|
||||||
A
|
A
|
||||||
@@ -54,4 +55,6 @@ A
|
|||||||
block1extended
|
block1extended
|
||||||
B
|
B
|
||||||
block2
|
block2
|
||||||
CB
|
C blockc2base
|
||||||
|
|
||||||
|
B
|
||||||
Reference in New Issue
Block a user