fix false replacement of "$t" inside double quotes

thanks to checat for reporting this
This commit is contained in:
messju
2006-08-03 20:03:20 +00:00
parent 3385c9f37d
commit bf3f34cab1
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- fix false replacement of "$t" inside double quotes (checat, messju)
- added support for column headings and caption element to html_table and
updated the output to use thead/tbody elements (boots)
- fixed ordering of replacements in trimwhitespace output filter (Getty, boots)

View File

@@ -1671,11 +1671,11 @@ class Smarty_Compiler extends Smarty {
// if contains unescaped $, expand it
if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) {
$_match = $_match[0];
rsort($_match);
reset($_match);
$_replace = array();
foreach($_match as $_var) {
$var_expr = str_replace ($_var, '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."', $var_expr);
$_replace[$_var] = '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."';
}
$var_expr = strtr($var_expr, $_replace);
$_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr);
} else {
$_return = $var_expr;