- bugfix {$smarty.section.name.loop} used together with {$smarty.section.name.total} could produce

wrong results (forum topic 27041) 3.1.32-dev-35
This commit is contained in:
Uwe Tews
2017-11-06 04:58:02 +01:00
parent 3fc8abeb98
commit 5220ca6776
3 changed files with 7 additions and 10 deletions

View File

@@ -2,6 +2,8 @@
05.11.2017
- lexer/parser optimization
- code cleanup and optimizations
- bugfix {$smarty.section.name.loop} used together with {$smarty.section.name.total} could produce
wrong results (forum topic 27041)
26.10.2017
- bugfix Smarty version was not filled in header comment of compiled and cached files

View File

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.32-dev-34';
const SMARTY_VERSION = '3.1.32-dev-35';
/**
* define variable scopes
*/

View File

@@ -141,12 +141,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
$v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))";
$t = 1;
}
if (isset($namedAttr[ 'loop' ])) {
$initNamedProperty[ 'loop' ] = "'loop' => {$v}";
if ($t === 1) {
$v = "{$sectionVar}->value['loop']";
}
} elseif ($t === 1) {
$initLocal[ 'loop' ] = $v;
$v = "{$local}loop";
}
@@ -338,7 +333,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
}
if (isset($namedAttr[ 'loop' ])) {
$initNamedProperty[ 'loop' ] = "'loop' => {$propValue['total']}";
$initNamedProperty[ 'loop' ] = "'loop' => {$propValue['loop']}";
}
if (isset($namedAttr[ 'total' ])) {
$initNamedProperty[ 'total' ] = "'total' => {$propValue['total']}";
@@ -393,7 +388,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo
if (isset($namedAttr[ 'last' ])) {
$output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} === {$propValue['total']});\n";
}
$output .= "?>";
$output .= '?>';
return $output;
}
@@ -463,7 +458,7 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase
$output .= "if ({$local}saved) {\n";
$output .= "{$sectionVar} = {$local}saved;\n";
$output .= "}\n";
$output .= "?>";
$output .= '?>';
return $output;
}