Bug #1673: ereg_replace doesn't handle \$var correctly
| From: | conley at enteka dot com | Date: | Tue, 06 Jul 1999 21:03:49 +0000 |
| Subject: | Bug #1673: ereg_replace doesn't handle \$var correctly | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8141@lists.php.net to get a copy of this message | ||
From: conley@enteka.com
Operating system: Solaris 2.6
PHP version: 3.0.9
PHP Bug Type: Other
Bug description: ereg_replace doesn't handle \$var correctly
In attempting to do lame macro functionality, I found that the \$login never matches strings like:
Your login is $login.
Here is the suspect code:
while (! feof($form)) {
// Grab a line at a time doing variable substitutions on $variable
$line = fgets($form,1023);
$new = ereg_replace("\$login", "newvalue", $line);
if ($line != $new) {
print "<PRE>line=[$line]</PRE>\n";
print "<PRE>new=[$new]</PRE>\n";
}
print $line;
}
If I change \$login to just login I find I get:
Your newvalue is $newvalue.
Which is correct, so I think the rest of the code is correct-- just the $ escaping is broken.