- bugfix a nocache template variable used as parameter at {insert} was by mistake cached

This commit is contained in:
Uwe Tews
2015-04-23 02:34:28 +02:00
parent de892651c2
commit c7ba22dc98
3 changed files with 12 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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);?>";