#42290 [Ana->Asn]: mb_eregi_replace() is not case-insensitive with multibyte pattern

From: Date: Sun, 19 Aug 2007 20:05:04 +0000
Subject: #42290 [Ana->Asn]: mb_eregi_replace() is not case-insensitive with multibyte pattern
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116323@lists.php.net to get a copy of this message
ID: 42290 Updated by: jani@php.net Reported By: arysin at gmail dot com -Status: Analyzed +Status: Assigned Bug Type: mbstring related Operating System: * PHP Version: 5.2CVS-2007-08-14 Assigned To: hirokawa New Comment: I'm using the bundled PCRE library. I don't remember what the version is. Previous Comments: ------------------------------------------------------------------------ [2007-08-19 02:27:06] hirokawa@php.net I got the same result as arysin, (PHP_5_2CVS 20070819, PCRE 7.2 2007-06-19) Šiltas, Xiltas Šiltas, Xiltas I think PCRE is also not working. Jani, which version of PHP/PCRE you are using ? ------------------------------------------------------------------------ [2007-08-17 13:46:13] jani@php.net Assigned to the maintainer of mbstring extension. ------------------------------------------------------------------------ [2007-08-14 09:11:37] jani@php.net I get this as output: Šiltas, Xiltas Xiltas, Xiltas So I don't think there's anything wrong with PCRE, just mbstring stuff. ------------------------------------------------------------------------ [2007-08-14 01:28:44] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42290&edit=1

« previous php.bugs (#116323) next »