diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 411c3024..ec8fadea 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -436,9 +436,6 @@ class Smarty_Compiler extends Smarty { break; case 'max': - $output .= "{$section_props}['$attr_name'] = max(0, (int)$attr_value);\n"; - break; - case 'start': $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n"; break; @@ -454,6 +451,9 @@ class Smarty_Compiler extends Smarty { if (!isset($attrs['max'])) $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; + else + $output .= "if ({$section_props}['max'] < 0)\n" . + " {$section_props}['max'] = {$section_props}['loop'];\n"; if (!isset($attrs['start'])) $output .= "{$section_props}['start'] = 0;\n"; diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 411c3024..ec8fadea 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -436,9 +436,6 @@ class Smarty_Compiler extends Smarty { break; case 'max': - $output .= "{$section_props}['$attr_name'] = max(0, (int)$attr_value);\n"; - break; - case 'start': $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n"; break; @@ -454,6 +451,9 @@ class Smarty_Compiler extends Smarty { if (!isset($attrs['max'])) $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; + else + $output .= "if ({$section_props}['max'] < 0)\n" . + " {$section_props}['max'] = {$section_props}['loop'];\n"; if (!isset($attrs['start'])) $output .= "{$section_props}['start'] = 0;\n";