From 1dd680df131bdc60467a47d3b6cd34f3b04cfa0d Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Tue, 12 Aug 2008 18:17:51 +0000 Subject: [PATCH] fix that function results can be used together with conditions like "is even" at the {if} tag (U.Tews) --- libs/Smarty_Compiler.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 08bdb6d7..b7d33a1c 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1363,9 +1363,14 @@ class Smarty_Compiler extends Smarty { /* If last token was a ')', we operate on the parenthesized expression. The start of the expression is on the stack. Otherwise, we operate on the last encountered token. */ - if ($tokens[$i-1] == ')') + if ($tokens[$i-1] == ')') { $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; /* Construct the argument for 'is' expression, so it knows what to operate on. */