|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-06-05 18:17 UTC] john43 at temple dot 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'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 06:00:01 2025 UTC |
IMHO its a strange Bug! In PHP 4.0.4.pl1 this Bug doesn't occure. I used this function to generate LATEX-Files for PDFLATEX. (In TEX you can force a newline by \\) So i used: preg_replace("/(\015\012)|(\015)|(\012)/","\\\\\n",$txt); to insert optional Text to the TEX-File and it work as expected in PHP 4.0.4.pl1 After changeing to PHP 4.2.3 suddenly this didn't work. I had to change to: preg_replace("/(\015\012)|(\015)|(\012)/","\\\\\\\n ",$txt); This IS a Bug and should become fixed!!! To check if the Bug is inside PHP or PCRE library i compiled PHP 4.0.4.pl1 and PHP 4.2.3 with the same PCRE library and got the same differences between the Versions. There were many changes in the php_pcre.c between the Versions an i think one (or some) of this changes cause this error. not bogus -> a bug