From 9ea847409c2cc5bee04f46d201b7048aee60932c Mon Sep 17 00:00:00 2001 From: mohrt Date: Thu, 9 Sep 2004 16:09:55 +0000 Subject: [PATCH] fix object parameter regex, allow one level of object indirection --- libs/Smarty_Compiler.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 82373263..c00973ff 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -137,7 +137,7 @@ class Smarty_Compiler extends Smarty { // #foo# // "text" // "text" - $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')'; + $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_num_const_regexp . '|' . $this->_qstr_regexp . ')'; // matches valid object call (no objects allowed in parameters): // $foo->bar @@ -148,8 +148,11 @@ class Smarty_Compiler extends Smarty { // $foo->bar->foo() // $foo->bar->foo->bar() $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')'; - $this->_obj_params_regexp = '\((?:(?:' . $this->_num_const_regexp . ')|\w+|' - . $this->_var_regexp . '(?:\s*,\s*(?:(?:\w+|' + $this->_obj_params_regexp = '\((?:\w+|(?:' + . $this->_var_regexp . '(?:' . $this->_obj_ext_regexp + . '(?:\((?:' . $this->_var_regexp + . '(?:\s*,\s*' . $this->_var_regexp + . ')*)?\))?)*)(?:\s*,\s*(?:(?:\w+|' . $this->_var_regexp . ')))*)?\)'; $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?)';