- bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable

This commit is contained in:
Uwe Tews
2015-03-14 15:17:58 +01:00
parent 8020144d46
commit 7fe81e6d79
2 changed files with 11 additions and 4 deletions

View File

@@ -1,5 +1,7 @@
 ===== 3.1.22-dev ===== (xx.xx.2015)  ===== 3.1.22-dev ===== (xx.xx.2015)
14.03.2015 14.03.2015
- bugfix {nocache} {/nocache} tags corrupted code when used within a nocache section caused by a nocache template variable.
- bugfix template functions defined with {function} in an included subtemplate could not be called in nocache - bugfix template functions defined with {function} in an included subtemplate could not be called in nocache
mode with {call... nocache} if the subtemplate had it's own cache file {forum 25452} mode with {call... nocache} if the subtemplate had it's own cache file {forum 25452}

View File

@@ -16,6 +16,13 @@
*/ */
class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
{ {
/**
* Array of names of valid option flags
*
* @var array
*/
public $option_flags = array();
/** /**
* Compiles code for the {nocache} tag * Compiles code for the {nocache} tag
* This tag does not generate compiled output. It only sets a compiler flag. * This tag does not generate compiled output. It only sets a compiler flag.
@@ -28,9 +35,7 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
public function compile($args, $compiler) public function compile($args, $compiler)
{ {
$_attr = $this->getAttributes($compiler, $args); $_attr = $this->getAttributes($compiler, $args);
if ($_attr['nocache'] === true) { $this->openTag($compiler, 'nocache', array($compiler->nocache));
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
}
// enter nocache mode // enter nocache mode
$compiler->nocache = true; $compiler->nocache = true;
// this tag does not return compiled code // this tag does not return compiled code
@@ -61,7 +66,7 @@ class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase
{ {
$_attr = $this->getAttributes($compiler, $args); $_attr = $this->getAttributes($compiler, $args);
// leave nocache mode // leave nocache mode
$compiler->nocache = false; list($compiler->nocache) = $this->closeTag($compiler, array('nocache'));
// this tag does not return compiled code // this tag does not return compiled code
$compiler->has_code = false; $compiler->has_code = false;