php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39999 mb_eregi_replace() and mb_ereg_replace() is not caseinsensitive for multibyte
Submitted: 2007-01-02 08:45 UTC Modified: 2007-01-11 16:05 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: zilvinas at speros dot lt Assigned:
Status: Not a bug Package: mbstring related
PHP Version: 5.2.0 OS: Debian 2.6.12-1-k7-smp
Private report: No CVE-ID: None
 [2007-01-02 08:45 UTC] zilvinas at speros dot lt
Description:
------------
The function mb_eregi_replace() and/or function mb_ereg_replace() with 'i' option is not caseinsensitive for multibyte characters.

Reproduce code:
---------------
<?php
mb_regex_encoding('UTF-8');

$pattern = utf8_encode('?');
$replace = 'X';
$subject = utf8_encode('?BER ?ber');

$result = mb_eregi_replace($pattern, $replace, $subject);
//$result = mb_ereg_replace($pattern, $replace, $subject, 'i');

echo utf8_decode($result) . "\n";
?>

Expected result:
----------------
XBER Xber

Actual result:
--------------
?BER Xber


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-02 09:37 UTC] zilvinas at speros dot lt
A more simplistic example to reproduce the problem:


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;
?>

Expected result: 
--------------
Xiltas, Xiltas


Actual result:
--------------
?iltas, Xiltas
 [2007-01-02 09:41 UTC] zilvinas at speros dot lt
changed category
 [2007-01-11 16:05 UTC] tony2001@php.net
ext/mbstring is a wrapper for Oniguruma library, which does the search and replace.
Therefore it's not PHP problem.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 18:03:37 2021 UTC