- 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)
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 nocache hash was not removed for <?xml ?> tags in subtemplates https://github.com/smarty-php/smarty/issues/300
27.09.2016
- 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;
}
phptag {
$obj = new Smarty_Internal_Compile_Private_Php();
$obj->parsePhp($this);
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
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) {
@@ -364,8 +363,7 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
phpstart {
$obj = new Smarty_Internal_Compile_Private_Php();
$obj->parsePhp($this);
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
text {
$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_element(res)::= text_content(t). {
res = $this->compiler->processText(t);

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff