ID: 41032
Updated by: [EMAIL PROTECTED]
Reported By: phpcoder at cyberpimp dot sexventure dot com
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Win98SE
PHP Version: 5.2.1
New Comment:
The documentation is correct:
var_dump('\''); - 1 char
var_dump('\"'); - 2 chars
var_dump('\0'); - 2 chars
var_dump('\\'); - 1 char
Previous Comments:
------------------------------------------------------------------------
[2007-04-09 23:07:21] phpcoder at cyberpimp dot sexventure dot com
Description:
------------
According to the documentation for preg_replace(), double-quotes,
apostrophes/single-quotes, backslashes, and nulls are supposed to be
returned escaped. However, only double-quotes and nulls are escaped;
apostrophes/single-quotes and backslashes are returned in their original
context.
Reproduce code:
---------------
<?php
header('Content-Type: text/plain; charset=US-ASCII');
$inputstring="'\"\0\\";
echo preg_replace('/([\\x00-\\xFF])/e',"strlen('$1').' chars returned
($1)'.\"\r\n\"",$inputstring);
?>
Expected result:
----------------
2 chars returned (\')
2 chars returned (\")
2 chars returned (\0)
2 chars returned (\\)
Actual result:
--------------
1 chars returned (')
2 chars returned (\")
2 chars returned (\0)
1 chars returned (\)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41032&edit=1