Bug #15203: ereg_replace fails on strings containing backslashes
| From: | josef dot svoboda at email dot cz | Date: | Thu, 24 Jan 2002 11:39:57 +0000 |
| Subject: | Bug #15203: ereg_replace fails on strings containing backslashes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-77985@lists.php.net to get a copy of this message | ||
From: josef.svoboda@email.cz
Operating system: FreeBSD 4.2
PHP version: 4.0.5
PHP Bug Type: POSIX related
Bug description: ereg_replace fails on strings containing backslashes
The goal is to replace sequence of two backslashes in $text by one
backslash. While preg_replace works, ereg_replace does not make any change
to $text.
echo "preg_replace\n";
$text="\\\\";
echo "--".$text."--".strlen($text)."\n";
$text=preg_replace( "/\\\\\\\\/", "\\\\", $text);
echo "--".$text."--".strlen($text)."\n";
echo "\n";
echo "ereg_replace\n";
$text="\\\\";
echo "--".$text."--".strlen($text)."\n";
$text=ereg_replace( "\\\\\\\\", "\\\\", $text);
echo "--".$text."--".strlen($text)."\n";
./configure \
--with-mysql=/usr/local/mysql \
--with-imap=/usr/ports/new/imap \
--enable-track-vars \
--enable-trans-sid
--
Edit bug report at: http://bugs.php.net/?id=15203&edit=1