fix a bug with stop token (when there is no stop token at all)

This commit is contained in:
fzerorubigd 2012-11-19 17:35:38 +03:30
parent 9fb753f75c
commit 4244730d24

View File

@ -138,10 +138,6 @@ class Handlebars_Template
&& $current[Handlebars_Tokenizer::TYPE] == Handlebars_Tokenizer::T_ESCAPED
&& $current[Handlebars_Tokenizer::NAME] === $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);
break;
}
switch ($current[Handlebars_Tokenizer::TYPE]) {
@ -172,6 +168,10 @@ 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);
return $buffer;
}
@ -198,13 +198,13 @@ class Handlebars_Template
&& $current[Handlebars_Tokenizer::TYPE] == Handlebars_Tokenizer::T_ESCAPED
&& $current[Handlebars_Tokenizer::NAME] === $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);
break;
}
}
//Ok break here, the helper should be aware of this.
$newStack = array_pop($this->_stack);
$newStack[0] = $index;
array_push($this->_stack, $newStack);
return '';
}