From b7e7def0b1b8636c502d0661a672b5d777fb080a Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Wed, 21 Mar 2018 07:36:11 +0100 Subject: [PATCH] - bugfix {$smarty.section...} used outside {section}{/section} showed incorrect values if {section}{/section} was called inside another loop https://github.com/smarty-php/smarty/issues/422 --- change_log.txt | 4 ++++ libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_compile_section.php | 6 +----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/change_log.txt b/change_log.txt index 1c19c53b..c72abc8d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,8 @@ ===== 3.1.32 - dev === +21.03.2018 + - bugfix {$smarty.section...} used outside {section}{/section} showed incorrect values if {section}{/section} was called inside + another loop https://github.com/smarty-php/smarty/issues/422 + 17.03.2018 - improvement Smarty::compileAllTemplates() exit with a non-zero status code if max errors is reached https://github.com/smarty-php/smarty/pull/402 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index c52c486e..1c6eefeb 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.32-dev-40'; + const SMARTY_VERSION = '3.1.32-dev-41'; /** * define variable scopes */ diff --git a/libs/sysplugins/smarty_internal_compile_section.php b/libs/sysplugins/smarty_internal_compile_section.php index 8b4f5034..6e80e0fd 100644 --- a/libs/sysplugins/smarty_internal_compile_section.php +++ b/libs/sysplugins/smarty_internal_compile_section.php @@ -104,8 +104,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - $initLocal = - array('saved' => "isset(\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']) ? \$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}'] : false",); + $initLocal = array(); $initNamedProperty = array(); $initFor = array(); $incFor = array(); @@ -455,9 +454,6 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase } else { $output .= "}\n}\n"; } - $output .= "if ({$local}saved) {\n"; - $output .= "{$sectionVar} = {$local}saved;\n"; - $output .= "}\n"; $output .= '?>'; return $output;