From: arysin at gmail dot com
Operating system: All
PHP version: 5.2.4RC1
PHP Bug Type: Regexps related
Bug description: mb_ereg_replace() and preg_replace() is not caseinsensitive
for multibyte
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
--
Edit bug report at http://bugs.php.net/?id=42290&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42290&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42290&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42290&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42290&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42290&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42290&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42290&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42290&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42290&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42290&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42290&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42290&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42290&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42290&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42290&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42290&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42290&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42290&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42290&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42290&r=mysqlcfg