diff --git a/change_log.txt b/change_log.txt index 6d65c732..2e0b397d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@  ===== 3.1.22-dev ===== (xx.xx.2015) + 23.04.2015 + - bugfix a nocache template variable used as parameter at {insert} was by mistake cached + 20.04.2015 - bugfix at a template function containing nocache code a parmeter could overwrite a template variable of same name diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 76ad37f1..7aa42bea 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.22-dev/18'; + const SMARTY_VERSION = '3.1.22-dev/19'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_compile_insert.php b/libs/sysplugins/smarty_internal_compile_insert.php index 4c658554..659b3f12 100644 --- a/libs/sysplugins/smarty_internal_compile_insert.php +++ b/libs/sysplugins/smarty_internal_compile_insert.php @@ -51,8 +51,11 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - // never compile as nocache code - $compiler->suppressNocacheProcessing = true; + $nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache); + if (!$nocacheParam) { + // do not compile as nocache code + $compiler->suppressNocacheProcessing = true; + } $compiler->tag_nocache = true; $_smarty_tpl = $compiler->template; $_name = null; @@ -116,19 +119,19 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase // convert attributes into parameter array string $_paramsArray = array(); foreach ($_attr as $_key => $_value) { - $_paramsArray[] = "'$_key' => $_value"; + $_paramsArray[] = "'$_key' => $_value"; } $_params = 'array(' . implode(", ", $_paramsArray) . ')'; // call insert if (isset($_assign)) { - if ($_smarty_tpl->caching) { + if ($_smarty_tpl->caching && !$nocacheParam) { $_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}',{$_assign});?>"; } else { $_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>"; } } else { $compiler->has_output = true; - if ($_smarty_tpl->caching) { + if ($_smarty_tpl->caching && !$nocacheParam) { $_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>"; } else { $_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";