|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-27 13:36 UTC] 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}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 04:00:01 2025 UTC |
Yes, I confirm that bug exists and I can reproduce it. I download latest snapshot and take my example from this report. The result still "{abc..def}{ab\1...\2ef}" instead of "{abc..def}{abc...def}". If you need any my assistance (my php.ini f.e.) please feel free to contact with me by my e-mail.