#17616 [Com]: backslash characters handled oddly in preg_replace
ID: 17616
Comment by: meg@lalooks.net
Reported By: john43@temple.edu
Status: Bogus
Bug Type: PCRE related
Operating System: linux 2.4.14, pcre
PHP Version: 4.3.0-dev
New Comment:
what do you people mean, "this isn't a bug"??!
php is such a joke.
Previous Comments:
------------------------------------------------------------------------
[2002-09-25 09:38:35] iliaa@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
not a bug -> bogus
------------------------------------------------------------------------
[2002-09-25 09:35:08] andrei@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
In the first case the extension receives replacement string \\\ which
is basically \\, since last backslash doesn't quote anything. And in
the second case it's \\\\ which is interpolated into \\.
------------------------------------------------------------------------
[2002-09-25 09:33:23] andrei@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
------------------------------------------------------------------------
[2002-09-11 19:44:28] iliaa@php.net
updated version.
------------------------------------------------------------------------
[2002-06-05 18:17:27] john43@temple.edu
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 this bug report at http://bugs.php.net/?id=17616&edit=1
Thread (7 messages)