ID: 39279
Updated by: [EMAIL PROTECTED]
Reported By: ivb at is dot ua
-Status: Open
+Status: Assigned
Bug Type: mbstring related
Operating System: Windows 2000 SP4
PHP Version: 5CVS-2006-10-27 (CVS)
-Assigned To:
+Assigned To: hirokawa
Previous Comments:
------------------------------------------------------------------------
[2006-10-27 13:36:17] ivb at is dot ua
Description:
------------
mb_ereg_replace() works incorrectly if 2nd parameter is multibyte and
contains substings \\n (n - digit). It returns substing \n itself
instead of corresponding parenthesized substring.
If 2nd parameter not multibyte - \\n correctly replaced with
corresponding parenthesized substrings.
If 2nd parameter multibyte, but not contains \\n substrings -
replacement works correctly.
Reproduce code:
---------------
<?php
function a2u ( $a ) {
return mb_convert_encoding ( $a, "UTF-16LE", "ASCII" );
}
function u2a ( $a ) {
return mb_convert_encoding ( $a, "ASCII", "UTF-16LE" );
}
mb_internal_encoding ( "UTF-16LE" );
mb_regex_encoding ( "UTF-16LE" );
$str = "abc..def";
$pat = "([^\.])\.\.([^\.])";
$rep = "\\1...\\2";
$res = mb_ereg_replace ( a2u ( $pat ), a2u ( $rep ), a2u ( $str ) );
echo "{" . $str . "}{" . u2a ( $res ) . "}\n";
?>
Expected result:
----------------
{abc..def}{abc...def}
Actual result:
--------------
{abc..def}{ab\1...\2ef}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39279&edit=1