From 7dec7d9963f4a0c15832ed382e6f903296821b45 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews@googlemail.com" Date: Tue, 18 Mar 2014 18:22:33 +0000 Subject: [PATCH] - revert change of 17.03.2014 --- change_log.txt | 5 +- .../smarty_internal_templatelexer.php | 1136 +++++++++-------- 2 files changed, 573 insertions(+), 568 deletions(-) diff --git a/change_log.txt b/change_log.txt index 10426670..552f1ab7 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,5 +1,8 @@ ===== trunk ===== - 17.03.2014 + 18.03.2014 + - revert change of 17.03.2014 + +17.03.2014 - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899) 15.03.2014 diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 82a00fab..1fc294ec 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -1,106 +1,106 @@ 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY'); - public $smarty_token_names = array ( // Text for parser error messages - 'IDENTITY' => '===', - 'NONEIDENTITY' => '!==', - 'EQUALS' => '==', - 'NOTEQUALS' => '!=', - 'GREATEREQUAL' => '(>=,ge)', - 'LESSEQUAL' => '(<=,le)', - 'GREATERTHAN' => '(>,gt)', - 'LESSTHAN' => '(<,lt)', - 'MOD' => '(%,mod)', - 'NOT' => '(!,not)', - 'LAND' => '(&&,and)', - 'LOR' => '(||,or)', - 'LXOR' => 'xor', - 'OPENP' => '(', - 'CLOSEP' => ')', - 'OPENB' => '[', - 'CLOSEB' => ']', - 'PTR' => '->', - 'APTR' => '=>', - 'EQUAL' => '=', - 'NUMBER' => 'number', - 'UNIMATH' => '+" , "-', - 'MATH' => '*" , "/" , "%', - 'INCDEC' => '++" , "--', - 'SPACE' => ' ', - 'DOLLAR' => '$', - 'SEMICOLON' => ';', - 'COLON' => ':', - 'DOUBLECOLON' => '::', - 'AT' => '@', - 'HATCH' => '#', - 'QUOTE' => '"', - 'BACKTICK' => '`', - 'VERT' => '|', - 'DOT' => '.', - 'COMMA' => '","', - 'ANDSYM' => '"&"', - 'QMARK' => '"?"', - 'ID' => 'identifier', - 'TEXT' => 'text', - 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', - 'PHPSTARTTAG' => 'PHP start tag', - 'PHPENDTAG' => 'PHP end tag', - 'LITERALSTART' => 'Literal start', - 'LITERALEND' => 'Literal end', - 'LDELSLASH' => 'closing tag', - 'COMMENT' => 'comment', - 'AS' => 'as', - 'TO' => 'to', - ); - - - function __construct($data,$compiler) - { -// $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data); - $this->data = $data; - $this->counter = 0; - $this->line = 1; - $this->smarty = $compiler->smarty; - $this->compiler = $compiler; - $this->ldel = preg_quote($this->smarty->left_delimiter,'/'); - $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->mbstring_overload = ini_get('mbstring.func_overload') & 2; - } - - public function PrintTrace() - { - $this->yyTraceFILE = fopen('php://output', 'w'); - $this->yyTracePrompt = '
'; - } + /** + * Smarty Internal Plugin Templatelexer + * + * This is the lexer to break the template source into tokens + * @package Smarty + * @subpackage Compiler + * @author Uwe Tews + */ + /** + * Smarty Internal Plugin Templatelexer + */ + class Smarty_Internal_Templatelexer + { + public $data; + public $counter; + public $token; + public $value; + public $node; + public $line; + public $taglineno; + public $state = 1; + private $heredoc_id_stack = Array(); + public $yyTraceFILE; + public $yyTracePrompt; + public $state_name = array (1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY'); + public $smarty_token_names = array ( // Text for parser error messages + 'IDENTITY' => '===', + 'NONEIDENTITY' => '!==', + 'EQUALS' => '==', + 'NOTEQUALS' => '!=', + 'GREATEREQUAL' => '(>=,ge)', + 'LESSEQUAL' => '(<=,le)', + 'GREATERTHAN' => '(>,gt)', + 'LESSTHAN' => '(<,lt)', + 'MOD' => '(%,mod)', + 'NOT' => '(!,not)', + 'LAND' => '(&&,and)', + 'LOR' => '(||,or)', + 'LXOR' => 'xor', + 'OPENP' => '(', + 'CLOSEP' => ')', + 'OPENB' => '[', + 'CLOSEB' => ']', + 'PTR' => '->', + 'APTR' => '=>', + 'EQUAL' => '=', + 'NUMBER' => 'number', + 'UNIMATH' => '+" , "-', + 'MATH' => '*" , "/" , "%', + 'INCDEC' => '++" , "--', + 'SPACE' => ' ', + 'DOLLAR' => '$', + 'SEMICOLON' => ';', + 'COLON' => ':', + 'DOUBLECOLON' => '::', + 'AT' => '@', + 'HATCH' => '#', + 'QUOTE' => '"', + 'BACKTICK' => '`', + 'VERT' => '|', + 'DOT' => '.', + 'COMMA' => '","', + 'ANDSYM' => '"&"', + 'QMARK' => '"?"', + 'ID' => 'identifier', + 'TEXT' => 'text', + 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', + 'PHPSTARTTAG' => 'PHP start tag', + 'PHPENDTAG' => 'PHP end tag', + 'LITERALSTART' => 'Literal start', + 'LITERALEND' => 'Literal end', + 'LDELSLASH' => 'closing tag', + 'COMMENT' => 'comment', + 'AS' => 'as', + 'TO' => 'to', + ); + function __construct($data,$compiler) + { + // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data); + $this->data = $data; + $this->counter = 0; + $this->line = 1; + $this->smarty = $compiler->smarty; + $this->compiler = $compiler; + $this->ldel = preg_quote($this->smarty->left_delimiter,'/'); + $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->mbstring_overload = ini_get('mbstring.func_overload') & 2; + } + + public function PrintTrace() + { + $this->yyTraceFILE = fopen('php://output', 'w'); + $this->yyTracePrompt = '
'; + } + + private $_yy_state = 1; private $_yy_stack = array(); @@ -142,7 +142,7 @@ class Smarty_Internal_Templatelexer } - + public function yylex1() { $tokenMap = array ( @@ -220,160 +220,160 @@ class Smarty_Internal_Templatelexer function yy_r1_1($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } function yy_r1_2($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_COMMENT; - } + $this->token = Smarty_Internal_Templateparser::TP_COMMENT; + } function yy_r1_4($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_STRIPON; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_STRIPON; + } + } function yy_r1_5($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; + } + } function yy_r1_6($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; - $this->yypushstate(self::LITERAL); - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; + $this->yypushstate(self::LITERAL); + } + } function yy_r1_7($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELIF; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELIF; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r1_9($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r1_10($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r1_11($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r1_12($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r1_13($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDEL; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDEL; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r1_14($yy_subpatterns) { - if (in_array($this->value, Array('token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG; - } elseif ($this->value == 'token = Smarty_Internal_Templateparser::TP_XMLTAG; - } else { - $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG; - $this->value = substr($this->value, 0, 2); - } - } + if (in_array($this->value, Array('token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG; + } elseif ($this->value == 'token = Smarty_Internal_Templateparser::TP_XMLTAG; + } else { + $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG; + $this->value = substr($this->value, 0, 2); + } + } function yy_r1_15($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG; - } + $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG; + } function yy_r1_16($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } function yy_r1_17($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG; - } + $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG; + } function yy_r1_18($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG; - } + $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG; + } function yy_r1_19($yy_subpatterns) { - if ($this->mbstring_overload) { - $to = mb_strlen($this->data,'latin1'); - } else { - $to = strlen($this->data); - } - preg_match("/{$this->ldel}|<\?|\?>|<%|%>/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); - if (isset($match[0][1])) { - $to = $match[0][1]; - } - if ($this->mbstring_overload) { - $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); - } else { - $this->value = substr($this->data,$this->counter,$to-$this->counter); - } - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } - + if ($this->mbstring_overload) { + $to = mb_strlen($this->data,'latin1'); + } else { + $to = strlen($this->data); + } + preg_match("/{$this->ldel}|<\?|\?>|<%|%>/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; + } + if ($this->mbstring_overload) { + $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); + } else { + $this->value = substr($this->data,$this->counter,$to-$this->counter); + } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } + public function yylex2() { $tokenMap = array ( @@ -500,377 +500,377 @@ class Smarty_Internal_Templatelexer function yy_r2_1($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_QUOTE; - $this->yypushstate(self::DOUBLEQUOTEDSTRING); - } + $this->token = Smarty_Internal_Templateparser::TP_QUOTE; + $this->yypushstate(self::DOUBLEQUOTEDSTRING); + } function yy_r2_2($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; - } + $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; + } function yy_r2_3($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; - $this->taglineno = $this->line; - } + $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; + $this->taglineno = $this->line; + } function yy_r2_5($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; - } + $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; + } function yy_r2_6($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_RDEL; - $this->yypopstate(); - } + $this->token = Smarty_Internal_Templateparser::TP_RDEL; + $this->yypopstate(); + } function yy_r2_7($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISIN; - } + $this->token = Smarty_Internal_Templateparser::TP_ISIN; + } function yy_r2_8($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_AS; - } + $this->token = Smarty_Internal_Templateparser::TP_AS; + } function yy_r2_9($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TO; - } + $this->token = Smarty_Internal_Templateparser::TP_TO; + } function yy_r2_10($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_STEP; - } + $this->token = Smarty_Internal_Templateparser::TP_STEP; + } function yy_r2_11($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; - } + $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; + } function yy_r2_12($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_IDENTITY; - } + $this->token = Smarty_Internal_Templateparser::TP_IDENTITY; + } function yy_r2_13($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY; - } + $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY; + } function yy_r2_14($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_EQUALS; - } + $this->token = Smarty_Internal_Templateparser::TP_EQUALS; + } function yy_r2_15($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS; - } + $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS; + } function yy_r2_17($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL; - } + $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL; + } function yy_r2_19($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL; - } + $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL; + } function yy_r2_21($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN; - } + $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN; + } function yy_r2_22($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN; - } + $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN; + } function yy_r2_23($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_MOD; - } + $this->token = Smarty_Internal_Templateparser::TP_MOD; + } function yy_r2_24($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_NOT; - } + $this->token = Smarty_Internal_Templateparser::TP_NOT; + } function yy_r2_25($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_LAND; - } + $this->token = Smarty_Internal_Templateparser::TP_LAND; + } function yy_r2_26($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_LOR; - } + $this->token = Smarty_Internal_Templateparser::TP_LOR; + } function yy_r2_27($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_LXOR; - } + $this->token = Smarty_Internal_Templateparser::TP_LXOR; + } function yy_r2_28($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISODDBY; - } + $this->token = Smarty_Internal_Templateparser::TP_ISODDBY; + } function yy_r2_29($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY; - } + $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY; + } function yy_r2_30($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISODD; - } + $this->token = Smarty_Internal_Templateparser::TP_ISODD; + } function yy_r2_31($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD; - } + $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD; + } function yy_r2_32($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY; - } + $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY; + } function yy_r2_33($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY; - } + $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY; + } function yy_r2_34($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISEVEN; - } + $this->token = Smarty_Internal_Templateparser::TP_ISEVEN; + } function yy_r2_35($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN; - } + $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN; + } function yy_r2_36($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY; - } + $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY; + } function yy_r2_37($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY; - } + $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY; + } function yy_r2_38($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; - } + $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; + } function yy_r2_42($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_OPENP; - } + $this->token = Smarty_Internal_Templateparser::TP_OPENP; + } function yy_r2_43($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; - } + $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; + } function yy_r2_44($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_OPENB; - } + $this->token = Smarty_Internal_Templateparser::TP_OPENB; + } function yy_r2_45($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; - } + $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; + } function yy_r2_46($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_PTR; - } + $this->token = Smarty_Internal_Templateparser::TP_PTR; + } function yy_r2_47($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_APTR; - } + $this->token = Smarty_Internal_Templateparser::TP_APTR; + } function yy_r2_48($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_EQUAL; - } + $this->token = Smarty_Internal_Templateparser::TP_EQUAL; + } function yy_r2_49($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_INCDEC; - } + $this->token = Smarty_Internal_Templateparser::TP_INCDEC; + } function yy_r2_50($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; - } + $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; + } function yy_r2_52($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_MATH; - } + $this->token = Smarty_Internal_Templateparser::TP_MATH; + } function yy_r2_54($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_AT; - } + $this->token = Smarty_Internal_Templateparser::TP_AT; + } function yy_r2_55($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_HATCH; - } + $this->token = Smarty_Internal_Templateparser::TP_HATCH; + } function yy_r2_56($yy_subpatterns) { - // 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) { - preg_match("/\s+/",$this->value,$match); - $this->value = $match[0]; - $this->token = Smarty_Internal_Templateparser::TP_SPACE; - } else { - $this->token = Smarty_Internal_Templateparser::TP_ATTR; - } - } + // 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) { + preg_match("/\s+/",$this->value,$match); + $this->value = $match[0]; + $this->token = Smarty_Internal_Templateparser::TP_SPACE; + } else { + $this->token = Smarty_Internal_Templateparser::TP_ATTR; + } + } function yy_r2_57($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ID; - } + $this->token = Smarty_Internal_Templateparser::TP_ID; + } function yy_r2_58($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_INTEGER; - } + $this->token = Smarty_Internal_Templateparser::TP_INTEGER; + } function yy_r2_59($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; - $this->yypopstate(); - } + $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; + $this->yypopstate(); + } function yy_r2_60($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_VERT; - } + $this->token = Smarty_Internal_Templateparser::TP_VERT; + } function yy_r2_61($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_DOT; - } + $this->token = Smarty_Internal_Templateparser::TP_DOT; + } function yy_r2_62($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_COMMA; - } + $this->token = Smarty_Internal_Templateparser::TP_COMMA; + } function yy_r2_63($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; - } + $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; + } function yy_r2_64($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; - } + $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; + } function yy_r2_65($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_COLON; - } + $this->token = Smarty_Internal_Templateparser::TP_COLON; + } function yy_r2_66($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ANDSYM; - } + $this->token = Smarty_Internal_Templateparser::TP_ANDSYM; + } function yy_r2_67($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_QMARK; - } + $this->token = Smarty_Internal_Templateparser::TP_QMARK; + } function yy_r2_68($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_HEX; - } + $this->token = Smarty_Internal_Templateparser::TP_HEX; + } function yy_r2_69($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_SPACE; - } + $this->token = Smarty_Internal_Templateparser::TP_SPACE; + } function yy_r2_70($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELIF; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELIF; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r2_72($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r2_73($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r2_74($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r2_75($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDEL; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDEL; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r2_76($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } - + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } + public function yylex3() { $tokenMap = array ( @@ -938,71 +938,71 @@ class Smarty_Internal_Templatelexer function yy_r3_1($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; - $this->yypushstate(self::LITERAL); - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; + $this->yypushstate(self::LITERAL); + } + } function yy_r3_2($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; - $this->yypopstate(); - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; + $this->yypopstate(); + } + } function yy_r3_3($yy_subpatterns) { - if (in_array($this->value, Array('token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG; - } else { - $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG; - $this->value = substr($this->value, 0, 2); - } - } + if (in_array($this->value, Array('token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG; + } else { + $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG; + $this->value = substr($this->value, 0, 2); + } + } function yy_r3_4($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG; - } + $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG; + } function yy_r3_5($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG; - } + $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG; + } function yy_r3_6($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG; - } + $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG; + } function yy_r3_7($yy_subpatterns) { - if ($this->mbstring_overload) { - $to = mb_strlen($this->data,'latin1'); - } else { - $to = strlen($this->data); - } - preg_match("/{$this->ldel}\/?literal{$this->rdel}|<\?|<%|\?>|%>/",$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"); - } - if ($this->mbstring_overload) { - $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); - } else { - $this->value = substr($this->data,$this->counter,$to-$this->counter); - } - $this->token = Smarty_Internal_Templateparser::TP_LITERAL; - } - + if ($this->mbstring_overload) { + $to = mb_strlen($this->data,'latin1'); + } else { + $to = strlen($this->data); + } + preg_match("/{$this->ldel}\/?literal{$this->rdel}|<\?|<%|\?>|%>/",$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"); + } + if ($this->mbstring_overload) { + $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); + } else { + $this->value = substr($this->data,$this->counter,$to-$this->counter); + } + $this->token = Smarty_Internal_Templateparser::TP_LITERAL; + } + public function yylex4() { $tokenMap = array ( @@ -1074,104 +1074,104 @@ class Smarty_Internal_Templatelexer function yy_r4_1($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELIF; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELIF; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r4_3($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r4_4($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r4_5($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r4_6($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } else { - $this->token = Smarty_Internal_Templateparser::TP_LDEL; - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } else { + $this->token = Smarty_Internal_Templateparser::TP_LDEL; + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } + } function yy_r4_7($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_QUOTE; - $this->yypopstate(); - } + $this->token = Smarty_Internal_Templateparser::TP_QUOTE; + $this->yypopstate(); + } function yy_r4_8($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; - $this->value = substr($this->value,0,-1); - $this->yypushstate(self::SMARTY); - $this->taglineno = $this->line; - } + $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; + $this->value = substr($this->value,0,-1); + $this->yypushstate(self::SMARTY); + $this->taglineno = $this->line; + } function yy_r4_9($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; - } + $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; + } function yy_r4_10($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } function yy_r4_11($yy_subpatterns) { - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } function yy_r4_15($yy_subpatterns) { - if ($this->mbstring_overload) { - $to = mb_strlen($this->data,'latin1'); - } else { - $to = strlen($this->data); - } - if ($this->mbstring_overload) { - $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); - } else { - $this->value = substr($this->data,$this->counter,$to-$this->counter); - } - $this->token = Smarty_Internal_Templateparser::TP_TEXT; - } - + if ($this->mbstring_overload) { + $to = mb_strlen($this->data,'latin1'); + } else { + $to = strlen($this->data); + } + if ($this->mbstring_overload) { + $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); + } else { + $this->value = substr($this->data,$this->counter,$to-$this->counter); + } + $this->token = Smarty_Internal_Templateparser::TP_TEXT; + } + public function yylex5() { $tokenMap = array ( @@ -1236,52 +1236,52 @@ class Smarty_Internal_Templatelexer function yy_r5_1($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - return false; - } else { - $this->token = Smarty_Internal_Templateparser::TP_STRIPON; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + return false; + } else { + $this->token = Smarty_Internal_Templateparser::TP_STRIPON; + } + } function yy_r5_2($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - return false; - } else { - $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + return false; + } else { + $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; + } + } function yy_r5_3($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - return false; - } else { - $this->yypopstate(); - return true; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + return false; + } else { + $this->yypopstate(); + return true; + } + } function yy_r5_4($yy_subpatterns) { - if ($this->mbstring_overload) { - $to = mb_strlen($this->data,'latin1'); - } else { - $to = strlen($this->data); - } - preg_match("/".$this->ldel."\s*((\/)?strip\s*".$this->rdel."|block\s+)/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); - if (isset($match[0][1])) { - $to = $match[0][1]; - } - if ($this->mbstring_overload) { - $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); - } else { - $this->value = substr($this->data,$this->counter,$to-$this->counter); - } - return false; - } - + if ($this->mbstring_overload) { + $to = mb_strlen($this->data,'latin1'); + } else { + $to = strlen($this->data); + } + preg_match("/".$this->ldel."\s*((\/)?strip\s*".$this->rdel."|block\s+)/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; + } + if ($this->mbstring_overload) { + $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); + } else { + $this->value = substr($this->data,$this->counter,$to-$this->counter); + } + return false; + } + public function yylex6() { $tokenMap = array ( @@ -1346,51 +1346,53 @@ class Smarty_Internal_Templatelexer function yy_r6_1($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; - } else { - $this->yypopstate(); - return true; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; + } else { + $this->yypopstate(); + return true; + } + } function yy_r6_2($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; - } else { - $this->yypopstate(); - return true; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; + } else { + $this->yypopstate(); + return true; + } + } function yy_r6_3($yy_subpatterns) { - if ($this->smarty->auto_literal && (strlen($this->value) > $this->ldel_length)) { - $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; - } else { - $this->yypopstate(); - return true; - } - } + if ($this->smarty->auto_literal && ($this->mbstring_overload ? (mb_strpos(" \n\t\r",mb_substr($this->value,$this->ldel_length,1,'latin1'),0,'latin1') !== false) : (strpos(" \n\t\r",substr($this->value,$this->ldel_length,1)) !== false))) { + $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; + } else { + $this->yypopstate(); + return true; + } + } function yy_r6_5($yy_subpatterns) { - if ($this->mbstring_overload) { - $to = mb_strlen($this->data,'latin1'); - } else { - $to = strlen($this->data); - } - preg_match("/".$this->ldel."\s*((\/)?block(\s|".$this->rdel.")|[\$]smarty\.block\.(child|parent)\s*".$this->rdel.")/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); - if (isset($match[0][1])) { - $to = $match[0][1]; - } - if ($this->mbstring_overload) { - $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); - } else { - $this->value = substr($this->data,$this->counter,$to-$this->counter); - } - $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; - } + if ($this->mbstring_overload) { + $to = mb_strlen($this->data,'latin1'); + } else { + $to = strlen($this->data); + } + preg_match("/".$this->ldel."\s*((\/)?block(\s|".$this->rdel.")|[\$]smarty\.block\.(child|parent)\s*".$this->rdel.")/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); + if (isset($match[0][1])) { + $to = $match[0][1]; + } + if ($this->mbstring_overload) { + $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1'); + } else { + $this->value = substr($this->data,$this->counter,$to-$this->counter); + } + $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE; + } -} + } + + \ No newline at end of file