mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
fix compile problem with numeric constants and math operator matching
This commit is contained in:
@@ -111,7 +111,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
// $foo[$bar]
|
// $foo[$bar]
|
||||||
// $foo[5][blah]
|
// $foo[5][blah]
|
||||||
// $foo[5].bar[$foobar][4]
|
// $foo[5].bar[$foobar][4]
|
||||||
$this->_dvar_math_regexp = '[\+\*\/\%]|-(?!>)';
|
$this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))';
|
||||||
$this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]';
|
$this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]';
|
||||||
$this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
|
$this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
|
||||||
. ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?';
|
. ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?';
|
||||||
@@ -148,7 +148,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
// $foo->bar->foo()
|
// $foo->bar->foo()
|
||||||
// $foo->bar->foo->bar()
|
// $foo->bar->foo->bar()
|
||||||
$this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
|
$this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
|
||||||
$this->_obj_params_regexp = '\((?:-?\d|\w+|'
|
$this->_obj_params_regexp = '\((?:(?:' . $this->_num_const_regexp . ')|\w+|'
|
||||||
. $this->_var_regexp . '(?:\s*,\s*(?:(?:\w+|'
|
. $this->_var_regexp . '(?:\s*,\s*(?:(?:\w+|'
|
||||||
. $this->_var_regexp . ')))*)?\)';
|
. $this->_var_regexp . ')))*)?\)';
|
||||||
$this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
|
$this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
|
||||||
|
Reference in New Issue
Block a user