- bugfix <?xml ... ?> including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47

This commit is contained in:
Uwe Tews
2015-06-01 22:26:45 +02:00
parent 3771ea8d35
commit fa269d418f
7 changed files with 754 additions and 729 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.25-dev===== (xx.xx.2015)
01.06.2105
- bugfix <?xml ... ?> including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47
27.05.2015
- bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43

View File

@@ -128,9 +128,15 @@ class Smarty_Internal_Templatelexer
*
* @var string
*/
public $yyTracePrompt;
/**
* XML flag true while processing xml
*
* @var bool
*/
public $is_xml = false;
/**
* state names
*

View File

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

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.25-dev/2';
const SMARTY_VERSION = '3.1.25-dev/3';
/**
* define variable scopes

View File

@@ -106,7 +106,9 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
$lex->taglineno = $lex->line;
$closeTag = '?>';
if (strpos($lex->value, '<?xml') === 0) {
$lex->phpType = 'xml';
$lex->is_xml = true;
$lex->token = Smarty_Internal_Templateparser::TP_NOCACHE;
return;
} elseif (strpos($lex->value, '<?') === 0) {
$lex->phpType = 'php';
} elseif (strpos($lex->value, '<%') === 0) {
@@ -115,6 +117,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
} elseif (strpos($lex->value, '%>') === 0) {
$lex->phpType = 'unmatched';
} elseif (strpos($lex->value, '?>') === 0) {
if ($lex->is_xml) {
$lex->is_xml = false;
$lex->token = Smarty_Internal_Templateparser::TP_NOCACHE;
return;
}
$lex->phpType = 'unmatched';
} elseif (strpos($lex->value, '<s') === 0) {
$lex->phpType = 'script';

View File

@@ -19,7 +19,6 @@
*/
class Smarty_Internal_Templatelexer
{
/**
* Source
*
@@ -143,9 +142,15 @@ class Smarty_Internal_Templatelexer
*
* @var string
*/
public $yyTracePrompt;
/**
* XML flag true while processing xml
*
* @var bool
*/
public $is_xml = false;
/**
* state names
*
@@ -1318,6 +1323,7 @@ class Smarty_Internal_Templatelexer
$this->value = substr($this->data, $this->counter, $to - $this->counter);
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
}
}

File diff suppressed because it is too large Load Diff