ID: 10626
Updated by: cynic
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Bogus
Bug Type: PCRE related
PHP Version: 4.0.5
Assigned To: 
Comments:

You escaped the $1000 on the PHP level, so literal $1000 was sent to PCRE, where $10 
was interpreted as a backreference, and since there aren't 10 capturing subpatterns in 
the pattern, you get an empty string for $10, and the rest is taken as a literal 
string.

Send further questions to php-general@ (after you RTFM, of course).

Previous Comments:
---------------------------------------------------------------------------

[2001-05-03 03:04:24] [EMAIL PROTECTED]
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

---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10626&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to