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