From 834ce4c641f740cc69b45d001417e5c8f61d3887 Mon Sep 17 00:00:00 2001 From: nikic Date: Wed, 21 Dec 2011 11:00:04 +0100 Subject: [PATCH] Fix loop increment on some for loops (fix #562) The inner loop incrementing code was not added on for loops where the body was not a Twig_Node (but e.g. a Twig_Node_If) --- lib/Twig/Node/For.php | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Twig/Node/For.php b/lib/Twig/Node/For.php index c8565f1..d9d25b3 100644 --- a/lib/Twig/Node/For.php +++ b/lib/Twig/Node/For.php @@ -22,7 +22,7 @@ class Twig_Node_For extends Twig_Node public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, $lineno, $tag = null) { - $body->setNode('_for_loop', $this->loop = new Twig_Node_ForLoop($lineno, $tag)); + $body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag))); if (null !== $ifexpr) { $body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag); -- 1.7.2.5