diff --git a/change_log.txt b/change_log.txt index 1f6e4f62..ce604dd3 100644 --- a/change_log.txt +++ b/change_log.txt @@ -3,7 +3,8 @@ - security possible PHP code injection on custom resources at display() or fetch() calls if the resource does not sanitize the template name - bugfix fix 'mkdir(): File exists' error on create directory from parallel - processes https://github.com/smarty-php/smarty/pull/377 + processes https://github.com/smarty-php/smarty/pull/377 + - bugfix solve preg_match() hhvm parameter problem https://github.com/smarty-php/smarty/pull/372 27.5.2017 - bugfix change compiled code for registered function and modifiers to called as callable to allow closures diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 9ea47469..234a4191 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.32-dev-13'; + const SMARTY_VERSION = '3.1.32-dev-14'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_configfilelexer.php b/libs/sysplugins/smarty_internal_configfilelexer.php index 7869ef38..942f37cd 100644 --- a/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/libs/sysplugins/smarty_internal_configfilelexer.php @@ -3,10 +3,9 @@ * Smarty Internal Plugin Configfilelexer * * This is the lexer to break the config file source into tokens - * - * @package Smarty + * @package Smarty * @subpackage Config - * @author Uwe Tews + * @author Uwe Tews */ /** @@ -15,9 +14,9 @@ * This is the config file lexer. * It is generated from the smarty_internal_configfilelexer.plex file * - * @package Smarty + * @package Smarty * @subpackage Compiler - * @author Uwe Tews + * @author Uwe Tews */ class Smarty_Internal_Configfilelexer { @@ -27,91 +26,78 @@ class Smarty_Internal_Configfilelexer * @var string */ public $data; - /** * Source length * * @var int */ public $dataLength = null; - /** * byte counter * * @var int */ public $counter; - /** * token number * * @var int */ public $token; - /** * token value * * @var string */ public $value; - /** * current line * * @var int */ public $line; - /** * state number * * @var int */ public $state = 1; - /** * Smarty object * * @var Smarty */ public $smarty = null; - /** * compiler object * * @var Smarty_Internal_Config_File_Compiler */ private $compiler = null; - /** * copy of config_booleanize * * @var bool */ private $configBooleanize = false; - /** * trace file * * @var resource */ public $yyTraceFILE; - /** * trace prompt * * @var string */ public $yyTracePrompt; - /** * state names * * @var array */ - public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', - 6 => 'TRIPPLE'); + public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE'); /** * storage for assembled token patterns @@ -119,15 +105,10 @@ class Smarty_Internal_Configfilelexer * @var string */ private $yy_global_pattern1 = null; - private $yy_global_pattern2 = null; - private $yy_global_pattern3 = null; - private $yy_global_pattern4 = null; - private $yy_global_pattern5 = null; - private $yy_global_pattern6 = null; /** @@ -141,7 +122,7 @@ class Smarty_Internal_Configfilelexer /** * constructor * - * @param string $data template source + * @param string $data template source * @param Smarty_Internal_Config_File_Compiler $compiler */ function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) @@ -150,7 +131,7 @@ class Smarty_Internal_Configfilelexer $this->dataLength = strlen($data); $this->counter = 0; if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) { - $this->counter += strlen($match[ 0 ]); + $this->counter += strlen($match[0]); } $this->line = 1; $this->compiler = $compiler; @@ -164,8 +145,8 @@ class Smarty_Internal_Configfilelexer $this->yyTracePrompt = '
'; } - private $_yy_state = 1; + private $_yy_state = 1; private $_yy_stack = array(); public function yylex() @@ -176,49 +157,40 @@ class Smarty_Internal_Configfilelexer public function yypushstate($state) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } } public function yypopstate() { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } $this->_yy_state = array_pop($this->_yy_stack); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } + } public function yybegin($state) { $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } } + public function yylex1() { if (!isset($this->yy_global_pattern1)) { - $this->yy_global_pattern1 = - "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"; + $this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS"; } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -228,15 +200,16 @@ class Smarty_Internal_Configfilelexer } do { - if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 START'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state START'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -261,13 +234,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const START = 1; function yy_r1_1() @@ -321,11 +296,11 @@ class Smarty_Internal_Configfilelexer $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; } + public function yylex2() { if (!isset($this->yy_global_pattern2)) { - $this->yy_global_pattern2 = - "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; + $this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS"; } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -335,15 +310,16 @@ class Smarty_Internal_Configfilelexer } do { - if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 VALUE'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state VALUE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -368,13 +344,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const VALUE = 2; function yy_r2_1() @@ -421,9 +399,7 @@ class Smarty_Internal_Configfilelexer function yy_r2_7() { - if (!$this->configBooleanize || - !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) - ) { + if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no"))) { $this->yypopstate(); $this->yypushstate(self::NAKED_STRING_VALUE); return true; //reprocess in new state @@ -448,6 +424,7 @@ class Smarty_Internal_Configfilelexer $this->yypopstate(); } + public function yylex3() { if (!isset($this->yy_global_pattern3)) { @@ -461,15 +438,16 @@ class Smarty_Internal_Configfilelexer } do { - if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 NAKED_STRING_VALUE'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state NAKED_STRING_VALUE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -494,13 +472,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const NAKED_STRING_VALUE = 3; function yy_r3_1() @@ -510,6 +490,7 @@ class Smarty_Internal_Configfilelexer $this->yypopstate(); } + public function yylex4() { if (!isset($this->yy_global_pattern4)) { @@ -523,15 +504,16 @@ class Smarty_Internal_Configfilelexer } do { - if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 COMMENT'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state COMMENT'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -556,13 +538,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const COMMENT = 4; function yy_r4_1() @@ -584,6 +568,7 @@ class Smarty_Internal_Configfilelexer $this->yypopstate(); } + public function yylex5() { if (!isset($this->yy_global_pattern5)) { @@ -597,15 +582,16 @@ class Smarty_Internal_Configfilelexer } do { - if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 SECTION'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state SECTION'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -630,13 +616,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const SECTION = 5; function yy_r5_1() @@ -652,6 +640,7 @@ class Smarty_Internal_Configfilelexer $this->yypopstate(); } + public function yylex6() { if (!isset($this->yy_global_pattern6)) { @@ -665,15 +654,16 @@ class Smarty_Internal_Configfilelexer } do { - if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 TRIPPLE'); + throw new Exception('Error: lexing failed because a rule matched' . + ' an empty string. Input "' . substr($this->data, + $this->counter, 5) . '... state TRIPPLE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -698,13 +688,15 @@ class Smarty_Internal_Configfilelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const TRIPPLE = 6; function yy_r6_1() @@ -720,8 +712,8 @@ class Smarty_Internal_Configfilelexer $to = strlen($this->data); preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); - if (isset($match[ 0 ][ 1 ])) { - $to = $match[ 0 ][ 1 ]; + if (isset($match[0][1])) { + $to = $match[0][1]; } else { $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); } @@ -729,4 +721,5 @@ class Smarty_Internal_Configfilelexer $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; } + } diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 8e870b75..bb171fa7 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -185,25 +185,48 @@ class Smarty_Internal_Templatelexer * @var array */ public $smarty_token_names = array( // Text for parser error messages - 'NOT' => '(!,not)', 'OPENP' => '(', 'CLOSEP' => ')', 'OPENB' => '[', - 'CLOSEB' => ']', 'PTR' => '->', 'APTR' => '=>', 'EQUAL' => '=', - 'NUMBER' => 'number', 'UNIMATH' => '+" , "-', 'MATH' => '*" , "/" , "%', - 'INCDEC' => '++" , "--', 'SPACE' => ' ', 'DOLLAR' => '$', - 'SEMICOLON' => ';', 'COLON' => ':', 'DOUBLECOLON' => '::', 'AT' => '@', - 'HATCH' => '#', 'QUOTE' => '"', 'BACKTICK' => '`', - 'VERT' => '"|" modifier', 'DOT' => '.', 'COMMA' => '","', - 'QMARK' => '"?"', 'ID' => 'id, name', 'TEXT' => 'text', - 'LDELSLASH' => '{/..} closing tag', 'LDEL' => '{...} Smarty tag', - 'COMMENT' => 'comment', 'AS' => 'as', 'TO' => 'to', - 'PHP' => '" '"<", "==" ... logical operator', - 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', - 'SCOND' => '"is even" ... if condition',); + 'NOT' => '(!,not)', + 'OPENP' => '(', + 'CLOSEP' => ')', + 'OPENB' => '[', + 'CLOSEB' => ']', + 'PTR' => '->', + 'APTR' => '=>', + 'EQUAL' => '=', + 'NUMBER' => 'number', + 'UNIMATH' => '+" , "-', + 'MATH' => '*" , "/" , "%', + 'INCDEC' => '++" , "--', + 'SPACE' => ' ', + 'DOLLAR' => '$', + 'SEMICOLON' => ';', + 'COLON' => ':', + 'DOUBLECOLON' => '::', + 'AT' => '@', + 'HATCH' => '#', + 'QUOTE' => '"', + 'BACKTICK' => '`', + 'VERT' => '"|" modifier', + 'DOT' => '.', + 'COMMA' => '","', + 'QMARK' => '"?"', + 'ID' => 'id, name', + 'TEXT' => 'text', + 'LDELSLASH' => '{/..} closing tag', + 'LDEL' => '{...} Smarty tag', + 'COMMENT' => 'comment', + 'AS' => 'as', + 'TO' => 'to', + 'PHP' => '" '"<", "==" ... logical operator', + 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', + 'SCOND' => '"is even" ... if condition', + ); /** * constructor * - * @param string $data template source + * @param string $data template source * @param Smarty_Internal_TemplateCompilerBase $compiler */ function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler) @@ -212,7 +235,7 @@ class Smarty_Internal_Templatelexer $this->dataLength = strlen($data); $this->counter = 0; if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) { - $this->counter += strlen($match[ 0 ]); + $this->counter += strlen($match[0]); } $this->line = 1; $this->smarty = $compiler->smarty; @@ -221,8 +244,8 @@ class Smarty_Internal_Templatelexer $this->ldel_length = strlen($this->smarty->left_delimiter); $this->rdel = preg_quote($this->smarty->right_delimiter, '/'); $this->rdel_length = strlen($this->smarty->right_delimiter); - $this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter; - $this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter; + $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter; + $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter; } public function PrintTrace() @@ -236,12 +259,11 @@ class Smarty_Internal_Templatelexer */ 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; private $_yy_stack = array(); public function yylex() @@ -252,52 +274,40 @@ class Smarty_Internal_Templatelexer public function yypushstate($state) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } } public function yypopstate() { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } $this->_yy_state = array_pop($this->_yy_stack); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } + } public function yybegin($state) { $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state); } } + public function yylex1() { 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+)|()|([?][>])|([%][>]))|\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+)|()|([?][>])|([%][>]))|\G([\S\s])/isS"; } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -307,15 +317,16 @@ class Smarty_Internal_Templatelexer } do { - if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 $this->token = key($yymatches); // token number @@ -340,13 +351,15 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const TEXT = 1; function yy_r1_1() @@ -359,8 +372,8 @@ class Smarty_Internal_Templatelexer { preg_match("/[*]{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); - if (isset($match[ 0 ][ 1 ])) { - $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]); + if (isset($match[0][1])) { + $to = $match[0][1] + strlen($match[0][0]); } else { $this->compiler->trigger_template_error("missing or misspelled comment closing tag '*{$this->smarty->right_delimiter}'"); } @@ -377,9 +390,7 @@ class Smarty_Internal_Templatelexer 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; } else { $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; @@ -390,9 +401,7 @@ class Smarty_Internal_Templatelexer 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; } else { $this->yypushstate(self::TAG); @@ -416,25 +425,19 @@ class Smarty_Internal_Templatelexer { $to = $this->dataLength; - preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|()|([?][>])|([%][>])/i", - $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); - if (isset($match[ 0 ][ 1 ])) { - $to = $match[ 0 ][ 1 ]; + preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|()|([?][>])|([%][>])/i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; } $this->value = substr($this->data, $this->counter, $to - $this->counter); $this->token = Smarty_Internal_Templateparser::TP_TEXT; } + public function yylex2() { 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*make_nocache\\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*make_nocache\\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 (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -444,15 +447,16 @@ class Smarty_Internal_Templatelexer } do { - if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 $this->token = key($yymatches); // token number @@ -477,13 +481,15 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const TAG = 2; function yy_r2_1() @@ -545,7 +551,7 @@ class Smarty_Internal_Templatelexer function yy_r2_10() { - if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] == self::TEXT) { + if ($this->_yy_stack[count($this->_yy_stack) - 1] == self::TEXT) { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT; $this->taglineno = $this->line; @@ -573,11 +579,11 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } + public function yylex3() { if (!isset($this->yy_global_pattern3)) { - $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel . - "\\s*)|\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)\\s+)|\G(\\s+(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([\S\s])/isS"; + $this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\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)\\s+)|\G(\\s+(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([\S\s])/isS"; } if (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -587,15 +593,16 @@ class Smarty_Internal_Templatelexer } do { - if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 $this->token = key($yymatches); // token number @@ -620,13 +627,15 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const TAGBODY = 3; function yy_r3_1() @@ -639,9 +648,7 @@ class Smarty_Internal_Templatelexer function yy_r3_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_TEXT; } else { $this->yypushstate(self::TAG); @@ -823,11 +830,9 @@ class Smarty_Internal_Templatelexer { // 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); - $this->value = $match[ 0 ]; + $this->value = $match[0]; $this->token = Smarty_Internal_Templateparser::TP_SPACE; } else { $this->token = Smarty_Internal_Templateparser::TP_ATTR; @@ -919,12 +924,11 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_TEXT; } + public function yylex4() { 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 (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -934,15 +938,16 @@ class Smarty_Internal_Templatelexer } do { - if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 $this->token = key($yymatches); // token number @@ -967,19 +972,21 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const LITERAL = 4; function yy_r4_1() { - $this->literal_cnt ++; + $this->literal_cnt++; $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } @@ -987,7 +994,7 @@ class Smarty_Internal_Templatelexer { if ($this->literal_cnt) { - $this->literal_cnt --; + $this->literal_cnt--; $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } else { $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; @@ -999,10 +1006,9 @@ class Smarty_Internal_Templatelexer { $to = $this->dataLength; - preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i", $this->data, $match, PREG_OFFSET_CAPTURE, - $this->counter); - if (isset($match[ 0 ][ 1 ])) { - $to = $match[ 0 ][ 1 ]; + preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; } else { $this->compiler->trigger_template_error("missing or misspelled literal closing tag"); } @@ -1010,15 +1016,11 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } + public function yylex5() { 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 (!isset($this->dataLength)) { $this->dataLength = strlen($this->data); @@ -1028,15 +1030,16 @@ class Smarty_Internal_Templatelexer } do { - if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) { - if (!isset($yymatches[ 0 ][ 1 ])) { + if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) { + if (!isset($yymatches[0][1])) { $yymatches = preg_grep("/(.|\s)+/", $yymatches); } else { $yymatches = array_filter($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 $this->token = key($yymatches); // token number @@ -1061,13 +1064,15 @@ class Smarty_Internal_Templatelexer continue; } } else { - throw new Exception('Unexpected input at line' . $this->line . ': ' . $this->data[ $this->counter ]); + throw new Exception('Unexpected input at line' . $this->line . + ': ' . $this->data[$this->counter]); } break; - } - while (true); + } while (true); + } // end function + const DOUBLEQUOTEDSTRING = 5; function yy_r5_1() @@ -1085,9 +1090,7 @@ class Smarty_Internal_Templatelexer 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; } else { $this->yypushstate(self::TAG); @@ -1098,9 +1101,7 @@ class Smarty_Internal_Templatelexer 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; } else { $this->yypushstate(self::TAG); @@ -1111,9 +1112,7 @@ class Smarty_Internal_Templatelexer 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; } else { $this->token = Smarty_Internal_Templateparser::TP_LDEL; @@ -1133,7 +1132,7 @@ class Smarty_Internal_Templatelexer { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; - $this->value = substr($this->value, 0, - 1); + $this->value = substr($this->value, 0, -1); $this->yypushstate(self::TAGBODY); $this->taglineno = $this->line; }