#17616 [Com]: backslash characters handled oddly in preg_replace

From: Date: Fri, 27 Sep 2002 18:48:15 +0000
Subject: #17616 [Com]: backslash characters handled oddly in preg_replace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-20600@lists.php.net to get a copy of this message
ID: 17616 Comment by: B_ulrich@t-online.de 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: 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 Previous Comments: ------------------------------------------------------------------------ [2002-09-25 19:21:00] meg@lalooks.net what do you people mean, "this isn't a bug"??! php is such a joke. ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/17616 -- Edit this bug report at http://bugs.php.net/?id=17616&edit=1

« previous php.bugs (#20600) next »