From: nikic Date: Wed, 21 Dec 2011 10:00:04 +0000 (+0100) Subject: Fix loop increment on some for loops (fix #562) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=834ce4c641f740cc69b45d001417e5c8f61d3887;p=web%2Fkonrad%2Ftwig.git 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) --- 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);