fix #4 , NEED TO ADD SOME TESTS ASAP

This commit is contained in:
fzerorubigd 2012-11-29 10:53:03 +03:30
parent 30795180a9
commit ecc1b11f2a

View File

@ -100,7 +100,7 @@ class Handlebars_Template
public function setStopToken($token)
{
$topStack = array_pop($this->_stack);
$topStack = array_pop($this->_stack);
$topStack[2] = $token;
array_push($this->_stack, $topStack);
}
@ -113,7 +113,7 @@ class Handlebars_Template
public function getStopToken()
{
$topStack = end($this->_stack);
$topStack = end($this->_stack);
return $topStack[2];
}
/**
@ -129,9 +129,6 @@ class Handlebars_Template
$context = new Handlebars_Context($context);
}
$topTree = end($this->_stack); //This method (render) never pop a value from stack
if (count($topTree) < 3) {
print_r($topTree);die();
}
list($index ,$tree, $stop) = $topTree;
$buffer = '';
@ -197,7 +194,6 @@ class Handlebars_Template
}
$topTree = end($this->_stack); //This method never pop a value from stack
list($index ,$tree, $stop) = $topTree;
while (array_key_exists($index, $tree)) {
$current = $tree[$index];
$index++;
@ -213,7 +209,7 @@ class Handlebars_Template
//Ok break here, the helper should be aware of this.
$newStack = array_pop($this->_stack);
$newStack[0] = $index;
$newStack[0] = false;
$newStack[2] = false;
array_push($this->_stack, $newStack);
}
return '';