#42290 [Opn]: mb_ereg_replace() and preg_replace() is not caseinsensitive for multibyte

From: Date: Tue, 14 Aug 2007 09:11:37 +0000
Subject: #42290 [Opn]: mb_ereg_replace() and preg_replace() is not caseinsensitive for multibyte
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-116040@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: Open -Bug Type: Regexps related +Bug Type: mbstring related Operating System: All PHP Version: 5.2.4RC1 New Comment: I get this as output: Šiltas, Xiltas Xiltas, Xiltas So I don't think there's anything wrong with PCRE, just mbstring stuff. Previous Comments: ------------------------------------------------------------------------ [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 (#116040) next »