[Phplib-commit] CVS: php-lib-stable/php template.inc,1.9,1.10
Brought to you by:
nhruby,
richardarcher
|
From: Richard A. <ric...@us...> - 2002-04-25 11:56:44
|
Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv17308
Modified Files:
template.inc
Log Message:
back out last change
Index: template.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/template.inc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** template.inc 25 Apr 2002 10:47:20 -0000 1.9
--- template.inc 25 Apr 2002 11:56:40 -0000 1.10
***************
*** 34,38 ****
* '\n' was also being stripped. Fix by replacing with &#(36|92); in set_var and unreplacing in finish (rha)
* in get_undefined, only match non-whitespace in variable tags as in finish. (Layne Weathers & rha)
- * new method of preventing '\' stripping instead of nasty &#(36|92); hack (Scott Lahteine)
*
*/
--- 34,37 ----
***************
*** 167,170 ****
--- 166,170 ----
if (!empty($varname)) {
if ($this->debug) print "scalar: set *$varname* to *$value*<br>\n";
+ $value = preg_replace(array('/\$([0-9])/', '/\\\\([0-9])/'), array('$\1', '\\1'), $value);
$this->varkeys[$varname] = "/".$this->varname($varname)."/";
$this->varvals[$varname] = $value;
***************
*** 175,178 ****
--- 175,179 ----
if (!empty($k)) {
if ($this->debug) print "array: set *$k* to *$v*<br>\n";
+ $v = preg_replace(array('/\$([0-9])/', '/\\\\([0-9])/'), array('$\1', '\\1'), $v);
$this->varkeys[$k] = "/".$this->varname($k)."/";
$this->varvals[$k] = $v;
***************
*** 188,192 ****
*/
function subst($varname) {
- $varvals_quoted = array();
if (!$this->loadfile($varname)) {
$this->halt("subst: unable to load $varname.");
--- 189,192 ----
***************
*** 194,204 ****
}
- // quote the replacement strings to prevent bogus stripping of special chars
- while(list($k, $v) = each($this->varvals)) {
- $varvals_quoted[$k] = preg_quote($v);
- }
-
$str = $this->get_var($varname);
! $str = preg_replace($this->varkeys, $varvals_quoted, $str);
return $str;
}
--- 194,199 ----
}
$str = $this->get_var($varname);
! $str = preg_replace($this->varkeys, $this->varvals, $str);
return $str;
}
***************
*** 342,345 ****
--- 337,341 ----
}
+ $str = preg_replace(array('/$([0-9])/', '/\([0-9])/'), array('$\1', '\\\1'), $str);
return $str;
}
|