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