Bug #79986 [NEW]: str_ireplace bug with diacritics characters
| From: | cryptooman at yandex dot ru | Date: | Mon, 17 Aug 2020 18:03:51 +0000 |
| Subject: | Bug #79986 [NEW]: str_ireplace bug with diacritics characters | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228628@lists.php.net to get a copy of this message | ||
From: cryptooman at yandex dot ru
Operating system: Ubuntu 18.04
PHP version: 7.2.33
Package: *General Issues
Bug Type: Bug
Bug description:str_ireplace bug with diacritics characters
Description:
------------
---
From manual page: https://php.net/function.str-ireplace
---
Function str_ireplace fails to replace diacritics characters if case
(lower or upper) of search pattern does not match case of characters in
subject string. Affected languages: french, russian, german, spanish,
etc. Short php-script sample provided below.
Test script:
---------------
<?php
// French
// Result: 1Ã 2Ã 3Ã 4Ã
// Expect: 11 22 33 44
echo str_ireplace(['à ', 'â', 'ä', 'æ'],
['1', '2', '3', '4'], 'Ã Ã
âà äà æÃ') . PHP_EOL;
// Result: à 1 â2 ä3 æ4
// Expect: 11 22 33 44
echo str_ireplace(['Ã', 'Ã', 'Ã', 'Ã'],
['1', '2', '3', '4'], 'Ã Ã
âà äà æÃ') . PHP_EOL;
// Russian
// Result: 1Ð 2Ð
// Expect: 11 22
echo str_ireplace(['Ñ', 'й'], ['1', '2'],
'ÑРйÐ') . PHP_EOL;
// Result: Ñ1 й2
// Expect: 11 22
echo str_ireplace(['Ð', 'Ð'], ['1', '2'],
'ÑРйÐ') . PHP_EOL;
--
Edit bug report at https://bugs.php.net/bug.php?id=79986&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79986&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79986&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79986&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79986&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79986&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79986&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79986&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79986&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79986&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79986&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79986&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79986&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79986&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79986&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79986&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79986&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79986&r=mysqlcfg