mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- 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:
@@ -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
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user