- bugfix parser did hang on text starting <?something https://github.com/smarty-php/smarty/issues/74

This commit is contained in:
Uwe Tews
2015-07-25 22:32:10 +02:00
parent f61084f70f
commit bb3dfc6fdf
4 changed files with 971 additions and 572 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.28-dev===== (xx.xx.2015)  ===== 3.1.28-dev===== (xx.xx.2015)
25.07.2015
- bugfix parser did hang on text starting <?something https://github.com/smarty-php/smarty/issues/74
20.07.2015 20.07.2015
- bugfix config files got recompiled on each request - bugfix config files got recompiled on each request
- improvement invalidate PHP 5.5 opcache for recompiled and cached templates https://github.com/smarty-php/smarty/issues/72 - improvement invalidate PHP 5.5 opcache for recompiled and cached templates https://github.com/smarty-php/smarty/issues/72

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.28-dev/30'; const SMARTY_VERSION = '3.1.28-dev/31';
/** /**
* define variable scopes * define variable scopes

View File

@@ -186,15 +186,21 @@ class Smarty_Internal_Templatelexer
* @var array * @var array
*/ */
public $smarty_token_names = array( // Text for parser error messages public $smarty_token_names = array( // Text for parser error messages
'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[', 'CLOSEB' => ']', 'PTR' => '->', 'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')',
'APTR' => '=>', 'EQUAL' => '=', 'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%', 'OPENB' => '[', 'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>',
'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$', 'SEMICOLON' => ';', 'COLON' => ':', 'EQUAL' => '=', 'NUMBER' => 'number', 'UNIMATH' => '+" , "-',
'DOUBLECOLON' => '::', 'AT' => '@', 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`', 'VERT' => '"|" modifier', 'MATH' => '*" , "/" , "%', 'INCDEC' => '++" , "--',
'DOT' => '.', 'COMMA' => '","', 'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text', 'SPACE' => ' ', 'DOLLAR' => '$', 'SEMICOLON' => ';',
'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag', 'COMMENT' => 'comment', 'AS' => 'as', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@', 'HATCH' => '#',
'TO' => 'to', 'PHP' => '"<?php", "<%", "{php}" tag', 'LOGOP' => '"<", "==" ... logical operator', 'QUOTE' => '"', 'BACKTICK' => '`', 'VERT' => '"|" modifier',
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', 'DOT' => '.', 'COMMA' => '","', 'QMARK' => '"?"',
'SCOND' => '"is even" ... if condition',); 'ID' => 'id, name', 'TEXT' => 'text',
'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag',
'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to',
'PHP' => '"<?php", "<%", "{php}" tag',
'LOGOP' => '"<", "==" ... logical operator',
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
'SCOND' => '"is even" ... if condition',);
/** /**
* constructor * constructor
@@ -231,7 +237,8 @@ class Smarty_Internal_Templatelexer
*/ */
public function isAutoLiteral() public function isAutoLiteral()
{ {
return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false; return $this->smarty->auto_literal &&
isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false;
} }
private $_yy_state = 1; private $_yy_state = 1;
@@ -277,7 +284,10 @@ class Smarty_Internal_Templatelexer
public function yylex1() public function yylex1()
{ {
if (!isset($this->yy_global_pattern1)) { if (!isset($this->yy_global_pattern1)) {
$this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php(.*?)" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS"; $this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php(.*?)" .
$this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel .
"\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel .
")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(<script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*>)|([?][>])|([%][>]))|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -292,7 +302,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TEXT'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state TEXT');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -354,7 +365,9 @@ class Smarty_Internal_Templatelexer
function yy_r1_7() function yy_r1_7()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
@@ -365,7 +378,9 @@ class Smarty_Internal_Templatelexer
function yy_r1_8() function yy_r1_8()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
@@ -390,7 +405,7 @@ class Smarty_Internal_Templatelexer
{ {
$to = strlen($this->data); $to = strlen($this->data);
preg_match("~($this->ldel)|([<]script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*[>])|([<][?])|([<][%])|([?][>])|([%][>])~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); preg_match("~($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[0][1])) { if (isset($match[0][1])) {
$to = $match[0][1]; $to = $match[0][1];
} }
@@ -401,7 +416,12 @@ class Smarty_Internal_Templatelexer
public function yylex2() public function yylex2()
{ {
if (!isset($this->yy_global_pattern2)) { if (!isset($this->yy_global_pattern2)) {
$this->yy_global_pattern2 = "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*setfilter\\s+)|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*)/isS"; $this->yy_global_pattern2 = "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel .
"\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel .
"\\s*setfilter\\s+)|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel .
")|\G(" . $this->ldel . "\\s*[\/](?:(?!block)[0-9]*[a-zA-Z_]\\w*)\\s*" . $this->rdel . ")|\G(" .
$this->ldel . "\\s*[$][0-9]*[a-zA-Z_]\\w*(\\s+nocache)?\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*[\/])|\G(" . $this->ldel . "\\s*)/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -416,7 +436,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TAG'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state TAG');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -531,7 +552,9 @@ class Smarty_Internal_Templatelexer
public function yylex3() public function yylex3()
{ {
if (!isset($this->yy_global_pattern3)) { if (!isset($this->yy_global_pattern3)) {
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\\s+(not\\s+)?(odd|even|div)\\s+by))\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G(" . $this->ldel . "\\s*)|\G([\S\s])/isS"; $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel .
")|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\\s+(not\\s+)?(odd|even|div)\\s+by))\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G(" .
$this->ldel . "\\s*)|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -546,7 +569,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TAGBODY '); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state TAGBODY ');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -754,7 +778,9 @@ class Smarty_Internal_Templatelexer
{ {
// resolve conflicts with shorttag and right_delimiter starting with '=' // resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) { if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) ==
$this->smarty->right_delimiter
) {
preg_match("~\s+~", $this->value, $match); preg_match("~\s+~", $this->value, $match);
$this->value = $match[0]; $this->value = $match[0];
$this->token = Smarty_Internal_Templateparser::TP_SPACE; $this->token = Smarty_Internal_Templateparser::TP_SPACE;
@@ -845,7 +871,9 @@ class Smarty_Internal_Templatelexer
function yy_r3_64() function yy_r3_64()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
@@ -862,7 +890,8 @@ class Smarty_Internal_Templatelexer
public function yylex4() public function yylex4()
{ {
if (!isset($this->yy_global_pattern4)) { if (!isset($this->yy_global_pattern4)) {
$this->yy_global_pattern4 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS"; $this->yy_global_pattern4 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -877,7 +906,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state LITERAL'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state LITERAL');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -946,7 +976,11 @@ class Smarty_Internal_Templatelexer
public function yylex5() public function yylex5()
{ {
if (!isset($this->yy_global_pattern5)) { if (!isset($this->yy_global_pattern5)) {
$this->yy_global_pattern5 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel . "\\s*[0-9]*[a-zA-Z_]\\w*)|\G(" . $this->ldel . "\\s*)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" . $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/isS"; $this->yy_global_pattern5 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*[\/]literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/])|\G(" . $this->ldel .
"\\s*[0-9]*[a-zA-Z_]\\w*)|\G(" . $this->ldel .
"\\s*)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" .
$this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -961,7 +995,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -1009,7 +1044,9 @@ class Smarty_Internal_Templatelexer
function yy_r5_3() function yy_r5_3()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
@@ -1020,7 +1057,9 @@ class Smarty_Internal_Templatelexer
function yy_r5_4() function yy_r5_4()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
$this->yypushstate(self::TAG); $this->yypushstate(self::TAG);
@@ -1031,7 +1070,9 @@ class Smarty_Internal_Templatelexer
function yy_r5_5() function yy_r5_5()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->token = Smarty_Internal_Templateparser::TP_LDEL;
@@ -1085,7 +1126,8 @@ class Smarty_Internal_Templatelexer
public function yylex6() public function yylex6()
{ {
if (!isset($this->yy_global_pattern6)) { if (!isset($this->yy_global_pattern6)) {
$this->yy_global_pattern6 = "/\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G([\S\s])/isS"; $this->yy_global_pattern6 = "/\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*[\/]strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -1100,7 +1142,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBODY'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state CHILDBODY');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -1136,7 +1179,9 @@ class Smarty_Internal_Templatelexer
function yy_r6_1() function yy_r6_1()
{ {
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
) {
return false; return false;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_STRIPON; $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
@@ -1146,7 +1191,9 @@ class Smarty_Internal_Templatelexer
function yy_r6_2() function yy_r6_2()
{ {
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
) {
return false; return false;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
@@ -1156,7 +1203,9 @@ class Smarty_Internal_Templatelexer
function yy_r6_3() function yy_r6_3()
{ {
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
) {
return false; return false;
} else { } else {
$this->yypopstate(); $this->yypopstate();
@@ -1168,7 +1217,8 @@ class Smarty_Internal_Templatelexer
{ {
$to = strlen($this->data); $to = strlen($this->data);
preg_match("~" . $this->ldel . "\s*(([/])?strip\s*" . $this->rdel . "|block\s+)~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); preg_match("~" . $this->ldel . "\s*(([/])?strip\s*" . $this->rdel .
"|block\s+)~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[0][1])) { if (isset($match[0][1])) {
$to = $match[0][1]; $to = $match[0][1];
} }
@@ -1179,7 +1229,9 @@ class Smarty_Internal_Templatelexer
public function yylex7() public function yylex7()
{ {
if (!isset($this->yy_global_pattern7)) { if (!isset($this->yy_global_pattern7)) {
$this->yy_global_pattern7 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G(" . $this->ldel . "\\s*[\/]block)|\G(" . $this->ldel . "\\s*[$]smarty\\.block\\.(child|parent))|\G([\S\s])/isS"; $this->yy_global_pattern7 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*block)|\G(" . $this->ldel . "\\s*[\/]block)|\G(" . $this->ldel .
"\\s*[$]smarty\\.block\\.(child|parent))|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -1194,7 +1246,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBLOCK'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state CHILDBLOCK');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -1230,7 +1283,9 @@ class Smarty_Internal_Templatelexer
function yy_r7_1() function yy_r7_1()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
@@ -1241,7 +1296,9 @@ class Smarty_Internal_Templatelexer
function yy_r7_2() function yy_r7_2()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
} else { } else {
$this->yypopstate(); $this->yypopstate();
@@ -1252,7 +1309,9 @@ class Smarty_Internal_Templatelexer
function yy_r7_3() function yy_r7_3()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
} else { } else {
$this->yypopstate(); $this->yypopstate();
@@ -1263,7 +1322,9 @@ class Smarty_Internal_Templatelexer
function yy_r7_4() function yy_r7_4()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
} else { } else {
$this->yypopstate(); $this->yypopstate();
@@ -1275,7 +1336,8 @@ class Smarty_Internal_Templatelexer
{ {
$to = strlen($this->data); $to = strlen($this->data);
preg_match("~" . $this->ldel . "\s*(literal\s*" . $this->rdel . "|([/])?block(\s|" . $this->rdel . ")|[\$]smarty\.block\.(child|parent))~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); preg_match("~" . $this->ldel . "\s*(literal\s*" . $this->rdel . "|([/])?block(\s|" . $this->rdel .
")|[\$]smarty\.block\.(child|parent))~i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[0][1])) { if (isset($match[0][1])) {
$to = $match[0][1]; $to = $match[0][1];
} }
@@ -1286,7 +1348,8 @@ class Smarty_Internal_Templatelexer
public function yylex8() public function yylex8()
{ {
if (!isset($this->yy_global_pattern8)) { if (!isset($this->yy_global_pattern8)) {
$this->yy_global_pattern8 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS"; $this->yy_global_pattern8 = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel .
"\\s*[\/]literal\\s*" . $this->rdel . ")|\G([\S\s])/isS";
} }
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
@@ -1301,7 +1364,8 @@ class Smarty_Internal_Templatelexer
$yymatches = array_filter($yymatches, 'strlen'); $yymatches = array_filter($yymatches, 'strlen');
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDLITERAL'); throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' .
substr($this->data, $this->counter, 5) . '... state CHILDLITERAL');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -1337,7 +1401,9 @@ class Smarty_Internal_Templatelexer
function yy_r8_1() function yy_r8_1()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
@@ -1348,7 +1414,9 @@ class Smarty_Internal_Templatelexer
function yy_r8_2() function yy_r8_2()
{ {
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
) {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
} else { } else {
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;

File diff suppressed because it is too large Load Diff