Bug #10668: preg_replace backquote failure
| From: | smoonen at andstuff dot org | Date: | Fri, 04 May 2001 15:44:19 +0000 |
| Subject: | Bug #10668: preg_replace backquote failure | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53858@lists.php.net to get a copy of this message | ||
From: smoonen@andstuff.org
Operating system: Linux
PHP version: 4.0.5
PHP Bug Type: PCRE related
Bug description: preg_replace backquote failure
The following code succeeds on PHP 4.03 and PHP 4.04pl1, but fails on PHP 4.05:
$str = "abc'\\\\''def";
function f($s) { return "x"; }
print preg_replace("/c(.*)d/e", "f('\\1')", $str, -1);
This seems to expose *two* underlying bugs:
1) There appears to be some problem in the regex state
machine
2) There is a definite problem with the replacement of
the backreference with its corresponding string.
--
Edit Bug report at: http://bugs.php.net/?id=10668&edit=1