Bug #12668: unexpected behavior of preg_replace
| From: | chuck at 1111-internet dot com | Date: | Thu, 09 Aug 2001 01:06:50 +0000 |
| Subject: | Bug #12668: unexpected behavior of preg_replace | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-62668@lists.php.net to get a copy of this message | ||
From: chuck@1111-internet.com
Operating system: FreeBSD 4.0
PHP version: 4.0.6
PHP Bug Type: PCRE related
Bug description: unexpected behavior of preg_replace
Simple problem - the script:
<?php
echo preg_replace("/'/e", "\"$0\"", "'");
// that's double-quote, slash, single-quote, slash, e, double-quote
// then double-quote, escaped double-quote, $0, escaped double-quote,
double-quote
// then double-quote, single-quote, double-quote
// meaning = "replace all occurrences of single-quote with the same string
matched during the search - i.e. single-quote"
?>
should produce one plain single-quote, but instead it produces an escaped
single-quote.
No other character seems to exhibit this behavior.
Configuration:
'./configure' '--prefix=/usr/local/php4' '--with-mysql'
'--with-apxs=/usr/local/sbin/apxs' '--enable-track-vars'
'--with-gd=/usr/local' '--with-zlib-dir=shared' '--with-ttf'
'--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local'
'--with-tiff-dir=/usr/local' '--with-mcrypt' '--with-pdflib'
No other unusual configuration setups
--
Edit bug report at: http://bugs.php.net/?id=12668&edit=1