fixed handling of digits inside tagnames. this problem slipped into

the regexps by adding support for numeric contants next to string
constants as variables.
This commit is contained in:
messju
2004-07-01 12:20:43 +00:00
parent 700678f471
commit cc08082d67
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- fix handling of digits inside tagnames (messju)
- fix escaping of backslashes in Smarty_Compiler::_quote_replace() (messju)
Version 2.6.3 (June 16, 2004)

View File

@@ -137,7 +137,7 @@ class Smarty_Compiler extends Smarty {
// #foo#
// "text"
// "text"
$this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_num_const_regexp . '|' . $this->_qstr_regexp . ')';
$this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')';
// matches valid object call (no objects allowed in parameters):
// $foo->bar
@@ -401,7 +401,7 @@ class Smarty_Compiler extends Smarty {
return '';
/* Split tag into two three parts: command, command modifiers and the arguments. */
if(! preg_match('/^(?:(' . $this->_obj_call_regexp . '|' . $this->_var_regexp
if(! preg_match('/^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp
. '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
(?:\s+(.*))?$
/xs', $template_tag, $match)) {
@@ -412,7 +412,7 @@ class Smarty_Compiler extends Smarty {
$tag_modifier = isset($match[2]) ? $match[2] : null;
$tag_args = isset($match[3]) ? $match[3] : null;
if (preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$!', $tag_command)) {
if (preg_match('!^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$!', $tag_command)) {
/* tag name is a variable or object */
$_return = $this->_parse_var_props($tag_command . $tag_modifier, $this->_parse_attrs($tag_args));
if(isset($_tag_attrs['assign'])) {