Bug #17616: backslash characters handled oddly in preg_replace
| From: | john43 at temple dot edu | Date: | Wed, 05 Jun 2002 22:17:27 +0000 |
| Subject: | Bug #17616: backslash characters handled oddly in preg_replace | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-9582@lists.php.net to get a copy of this message | ||
From: john43@temple.edu
Operating system: linux 2.4.14, pcre
PHP version: 4.1.2
PHP Bug Type: PCRE related
Bug description: backslash characters handled oddly in preg_replace
Below are two calls to preg_replace() with different replacement strings.
For some reason, they both return the same string.
$s = "A backslash: \\ ";
$s1 = preg_replace("/\\\\/", "\\\\\\", $s);
$s2 = preg_replace("/\\\\/", "\\\\\\\\", $s);
echo "s : $s \n";
echo "s1: $s1 \n";
echo "s2: $s2 \n";
------------------
Output:
s : A backslash: \
s1: A backslash: \\
s2: A backslash: \\
------------------
My configuration:
'./configure' '--with-gnu-ld' '--with-apxs=/usr/local/apache/bin/apxs'
'--with-mysql=/usr/local/mysql'
--
Edit bug report at http://bugs.php.net/?id=17616&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17616&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17616&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17616&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17616&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17616&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17616&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17616&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17616&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17616&r=globals