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+)|(