diff --git a/NEWS b/NEWS index 7a954f4a..aa2abc0b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - fix 'is even by' and 'is odd by' logic (Monte) - add day_empty, month_empty, year_empty and all_empty attributes to html_select_date (messju) - add table of explanation for {if} qualifiers in docs (boots) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 73d3a0a7..eb991810 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1385,7 +1385,7 @@ class Smarty_Compiler extends Smarty { if (@$tokens[$expr_end] == 'by') { $expr_end++; $expr_arg = $tokens[$expr_end++]; - $expr = "!(($is_arg / $expr_arg) % " . $this->_parse_var_props($expr_arg) . ")"; + $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; } else $expr = "!($is_arg % 2)"; break; @@ -1394,7 +1394,7 @@ class Smarty_Compiler extends Smarty { if (@$tokens[$expr_end] == 'by') { $expr_end++; $expr_arg = $tokens[$expr_end++]; - $expr = "(($is_arg / $expr_arg) % ". $this->_parse_var_props($expr_arg) . ")"; + $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; } else $expr = "($is_arg % 2)"; break;