we shouldn't compare context with string as __toString will be called

This commit is contained in:
behrooz shabani (everplays) 2012-10-29 15:42:42 +03:30
parent bdc3643544
commit 6319950bca

View File

@ -8,6 +8,7 @@
* @category Xamin * @category Xamin
* @package Handlebars * @package Handlebars
* @author fzerorubigd <fzerorubigd@gmail.com> * @author fzerorubigd <fzerorubigd@gmail.com>
* @author Behrooz Shabani <everplays@gmail.com>
* @copyright 2012 (c) ParsPooyesh Co * @copyright 2012 (c) ParsPooyesh Co
* @license GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html> * @license GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
* @version GIT: $Id$ * @version GIT: $Id$
@ -21,6 +22,7 @@
* @category Xamin * @category Xamin
* @package Handlebars * @package Handlebars
* @author fzerorubigd <fzerorubigd@gmail.com> * @author fzerorubigd <fzerorubigd@gmail.com>
* @author Behrooz Shabani <everplays@gmail.com>
* @copyright 2012 (c) ParsPooyesh Co * @copyright 2012 (c) ParsPooyesh Co
* @license GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html> * @license GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
* @version Release: @package_version@ * @version Release: @package_version@
@ -125,7 +127,7 @@ class Handlebars_Context
} else { } else {
$chunks = explode('.', $variableName); $chunks = explode('.', $variableName);
foreach ($chunks as $chunk) { foreach ($chunks as $chunk) {
if ($current == '') { if (is_string($current) and $current == '') {
return $current; return $current;
} }
$current = $this->_findVariableInContext($current, $chunk); $current = $this->_findVariableInContext($current, $chunk);