diff --git a/NEWS b/NEWS index e31b6832..65f22778 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - change embedded variable logic to only recognize $foo and + $foo[0][bar] syntax (Monte) - allow null as function attribute value (André Rabold, Monte) - support $foo->bar[index] syntax (Monte) diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index d2126ff4..d36ba418 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -1446,7 +1446,7 @@ class Smarty_Compiler extends Smarty { function _expand_quoted_text($var_expr) { // if contains unescaped $, expand it - if(preg_match_all('|(?_dvar_guts_regexp . '|', $var_expr, $match)) { + if(preg_match_all('|(?_var_bracket_regexp . ')*|', $var_expr, $match)) { rsort($match[0]); reset($match[0]); foreach($match[0] as $var) { @@ -1533,7 +1533,7 @@ class Smarty_Compiler extends Smarty { } // look for variables imbedded in quoted strings, replace them - if(preg_match('!' . $this->_qstr_regexp . '!', $output, $match)) { + if(preg_match('|(?_expand_quoted_text($match[0]), $output); } diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index d2126ff4..d36ba418 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1446,7 +1446,7 @@ class Smarty_Compiler extends Smarty { function _expand_quoted_text($var_expr) { // if contains unescaped $, expand it - if(preg_match_all('|(?_dvar_guts_regexp . '|', $var_expr, $match)) { + if(preg_match_all('|(?_var_bracket_regexp . ')*|', $var_expr, $match)) { rsort($match[0]); reset($match[0]); foreach($match[0] as $var) { @@ -1533,7 +1533,7 @@ class Smarty_Compiler extends Smarty { } // look for variables imbedded in quoted strings, replace them - if(preg_match('!' . $this->_qstr_regexp . '!', $output, $match)) { + if(preg_match('|(?_expand_quoted_text($match[0]), $output); }