- bugfix nocache hash was not removed for <?xml ?> tags in subtemplates https://github.com/smarty-php/smarty/issues/300

This commit is contained in:
uwetews
2016-09-28 23:39:05 +02:00
parent 998c778948
commit 5b508b7bf3
7 changed files with 892 additions and 907 deletions

View File

@@ -1,6 +1,7 @@
===== 3.1.31-dev ===== (xx.xx.xx) ===== 3.1.31-dev ===== (xx.xx.xx)
28.09.2016 28.09.2016
- bugfix the generated code for calling a subtemplate must pass the template resource name in single quotes https://github.com/smarty-php/smarty/issues/299 - bugfix the generated code for calling a subtemplate must pass the template resource name in single quotes https://github.com/smarty-php/smarty/issues/299
- bugfix nocache hash was not removed for <?xml ?> tags in subtemplates https://github.com/smarty-php/smarty/issues/300
27.09.2016 27.09.2016
- bugfix when Smarty does use an internally cached template object on Smarty::fetch() calls - bugfix when Smarty does use an internally cached template object on Smarty::fetch() calls

View File

@@ -341,8 +341,7 @@ class Smarty_Internal_Templatelexer
return false; return false;
} }
phptag { phptag {
$obj = new Smarty_Internal_Compile_Private_Php(); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
$obj->parsePhp($this);
} }
ldel literal rdel { ldel literal rdel {
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) { if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
@@ -364,8 +363,7 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
phpstart { phpstart {
$obj = new Smarty_Internal_Compile_Private_Php(); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
$obj->parsePhp($this);
} }
text { text {
$to = strlen($this->data); $to = strlen($this->data);

View File

@@ -271,13 +271,6 @@ template_element(res)::= PHP(o). {
} }
} }
// nocache code
template_element(res)::= NOCACHE(c). {
$this->compiler->tag_nocache = true;
$save = $this->template->compiled->has_nocache_code;
res = new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode("<?php echo '{c}';?>\n", true));
$this->template->compiled->has_nocache_code = $save;
}
// template text // template text
template_element(res)::= text_content(t). { template_element(res)::= text_content(t). {
res = $this->compiler->processText(t); res = $this->compiler->processText(t);

View File

@@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.31-dev/31'; const SMARTY_VERSION = '3.1.31-dev/32';
/** /**
* define variable scopes * define variable scopes

View File

@@ -42,7 +42,6 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
$compiler->has_code = false; $compiler->has_code = false;
if ($_attr[ 'type' ] == 'xml') { if ($_attr[ 'type' ] == 'xml') {
$compiler->tag_nocache = true; $compiler->tag_nocache = true;
$save = $compiler->template->compiled->has_nocache_code;
$output = addcslashes($_attr[ 'code' ], "'\\"); $output = addcslashes($_attr[ 'code' ], "'\\");
$compiler->parser->current_buffer->append_subtree($compiler->parser, $compiler->parser->current_buffer->append_subtree($compiler->parser,
new Smarty_Internal_ParseTree_Tag($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser,
@@ -50,7 +49,6 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
$output . $output .
"';?>", "';?>",
true))); true)));
$compiler->template->compiled->has_nocache_code = $save;
return ''; return '';
} }
if ($_attr[ 'type' ] != 'tag') { if ($_attr[ 'type' ] != 'tag') {
@@ -121,7 +119,7 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
$closeTag = '?>'; $closeTag = '?>';
if (strpos($lex->value, '<?xml') === 0) { if (strpos($lex->value, '<?xml') === 0) {
$lex->is_xml = true; $lex->is_xml = true;
$lex->token = Smarty_Internal_Templateparser::TP_NOCACHE; $lex->phpType = 'xml';
return; return;
} elseif (strpos($lex->value, '<?') === 0) { } elseif (strpos($lex->value, '<?') === 0) {
$lex->phpType = 'php'; $lex->phpType = 'php';
@@ -133,7 +131,7 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
} elseif (strpos($lex->value, '?>') === 0) { } elseif (strpos($lex->value, '?>') === 0) {
if ($lex->is_xml) { if ($lex->is_xml) {
$lex->is_xml = false; $lex->is_xml = false;
$lex->token = Smarty_Internal_Templateparser::TP_NOCACHE; $lex->phpType = 'xml';
return; return;
} }
$lex->phpType = 'unmatched'; $lex->phpType = 'unmatched';

View File

@@ -361,8 +361,7 @@ class Smarty_Internal_Templatelexer
function yy_r1_3() function yy_r1_3()
{ {
$obj = new Smarty_Internal_Compile_Private_Php(); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
$obj->parsePhp($this);
} }
function yy_r1_7() function yy_r1_7()
@@ -400,8 +399,7 @@ class Smarty_Internal_Templatelexer
function yy_r1_10() function yy_r1_10()
{ {
$obj = new Smarty_Internal_Compile_Private_Php(); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
$obj->parsePhp($this);
} }
function yy_r1_19() function yy_r1_19()

File diff suppressed because it is too large Load Diff