From d43d777ce6ec22d14b9019fede71ce169e47926f Mon Sep 17 00:00:00 2001 From: fzerorubigd Date: Mon, 19 Nov 2012 17:56:10 +0330 Subject: [PATCH] change stack position just if there is stop token available --- src/Handlebars/Template.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Handlebars/Template.php b/src/Handlebars/Template.php index 54e7288..0ace75d 100644 --- a/src/Handlebars/Template.php +++ b/src/Handlebars/Template.php @@ -168,10 +168,12 @@ class Handlebars_Template throw new RuntimeException('Invalid node type : ' . json_encode($current)); } } - //Ok break here, the helper should be aware of this. - $newStack = array_pop($this->_stack); - $newStack[0] = $index; - array_push($this->_stack, $newStack); + if ($this->_stopToken) { + //Ok break here, the helper should be aware of this. + $newStack = array_pop($this->_stack); + $newStack[0] = $index; + array_push($this->_stack, $newStack); + } return $buffer; } @@ -201,10 +203,12 @@ class Handlebars_Template break; } } - //Ok break here, the helper should be aware of this. - $newStack = array_pop($this->_stack); - $newStack[0] = $index; - array_push($this->_stack, $newStack); + if ($this->_stopToken) { + //Ok break here, the helper should be aware of this. + $newStack = array_pop($this->_stack); + $newStack[0] = $index; + array_push($this->_stack, $newStack); + } return ''; }