|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2007-08-14 01:28 UTC] arysin at gmail dot com
 Description:
------------
The function mb_eregi_replace() and/or function mb_ereg_replace() with
'i' option is not caseinsensitive for multibyte characters.
The same problem occurs for preg_replace() with /i option.
This bug was reported before twice:
1) (#39999) and was marked as Bogus stating it's not php bug. 
2) (#25953) was marked as Won't fix with note "Probably the issue will
be resolved in php5."
As one cannot add anything to closed bug I'd like to reopen this bug here for the reason stated below:
This library is not linked dynamically, on contrary its source is present in php source repository. So there's no way for php users to have this problem fixed without php itself being fixed.
More than that, the version of oniguruma in php repository is pretty old so at least importing the newer version of it would be a nice try to fix this bug.
Reproduce code:
---------------
<?
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
$pattern = '?'; //s 'crown'
$replace = 'X';
$subject = '?iltas, ?iltas';
$result = mb_eregi_replace($pattern, $replace, $subject);
echo $result;
$result = preg_replace("/$pattern/iu", $replace, $subject);
echo $result . "\n";
?>
Expected result:
----------------
Xiltas, Xiltas
Xiltas, Xiltas
Actual result:
--------------
?iltas, Xiltas
?iltas, Xiltas
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 14:00:01 2025 UTC | 
Hi, please find code snippet which shoes that it doesn't work: mb_internal_encoding("UTF-8"); mb_regex_encoding("UTF-8"); // Text contains three words with same letters, only with some uppercases. $hText = 'ՀԱՅԱՍՏԱՆԸ Հայաստան հայաստան'; // None of these two is working and only the last word is being replaced. echo mb_eregi_replace ('հայաստան', '<strong>\\0</strong>', $hText).'<br/>'; echo mb_ereg_replace ('հայաստան', '<strong>\\0</strong>', $hText, 'msri').'<br/>'; Best, Gevorg