Bug #10626: escaping doesn't work in the replacement clause

From: Date: Thu, 03 May 2001 07:04:25 +0000
Subject: Bug #10626: escaping doesn't work in the replacement clause
Groups: php.dev 
Request: Send a blank email to php-dev+get-53516@lists.php.net to get a copy of this message
From: hover@mi.ru Operating system: FreeBSD 4.3 PHP version: 4.0.5 PHP Bug Type: PCRE related Bug description: escaping doesn't work in the replacement clause The problem is that preg_replace() ignores escaping of $nn sequence in the replacement string. <? $str = preg_replace("/a/", "\$1000", "test ... a ... test"); echo $str; ?> test ... 00 ... test ----------- #!/usr/local/bin/perl -w $_ = "test ... a ... test"; s/a/\$1000/; print; ----------- test ... $1000 ... test This feature leads to impossibility of passing strings like '$1000' via phplib template variables. PHP 4.0.4pl1, 4.0.5 -- Edit Bug report at: http://bugs.php.net/?id=10626&edit=1

« previous php.dev (#53516) next »