fix that function results can be used together with conditions like "is even" at the {if} tag (U.Tews)

This commit is contained in:
Uwe.Tews
2008-08-12 18:17:51 +00:00
parent 380e0d0d6b
commit 1dd680df13

View File

@@ -1363,9 +1363,14 @@ class Smarty_Compiler extends Smarty {
/* If last token was a ')', we operate on the parenthesized /* If last token was a ')', we operate on the parenthesized
expression. The start of the expression is on the stack. expression. The start of the expression is on the stack.
Otherwise, we operate on the last encountered token. */ Otherwise, we operate on the last encountered token. */
if ($tokens[$i-1] == ')') if ($tokens[$i-1] == ')') {
$is_arg_start = array_pop($is_arg_stack); $is_arg_start = array_pop($is_arg_stack);
else if ($is_arg_start != 0) {
if (preg_match('~^' . $this->_func_regexp . '$~', $tokens[$is_arg_start-1])) {
$is_arg_start--;
}
}
} else
$is_arg_start = $i-1; $is_arg_start = $i-1;
/* Construct the argument for 'is' expression, so it knows /* Construct the argument for 'is' expression, so it knows
what to operate on. */ what to operate on. */