Skip to content

Commit 5ab7b30

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79986: str_ireplace bug with diacritics characters
2 parents 10df94d + 844a2dd commit 5ab7b30

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ PHP NEWS
1010
. Fixed bug #80002 (calc free space for new interned string is wrong).
1111
(t-matsuno)
1212

13+
- Standard:
14+
. Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb)
15+
1316
03 Sep 2020, PHP 7.4.10
1417

1518
- Core:

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3140,7 +3140,7 @@ static zend_string* php_char_to_str_ex(zend_string *str, char from, char *to, si
31403140
{
31413141
zend_string *result;
31423142
size_t char_count = 0;
3143-
char lc_from = 0;
3143+
int lc_from = 0;
31443144
const char *source, *source_end= ZSTR_VAL(str) + ZSTR_LEN(str);
31453145
char *target;
31463146

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #79986 (str_ireplace bug with diacritics characters)
3+
--SKIPIF--
4+
<?php
5+
if (!setlocale(LC_ALL, 'de_DE.ISO-8859-1', 'de-DE')) die('skip German locale not available');
6+
?>
7+
--FILE--
8+
<?php
9+
setlocale(LC_ALL, 'de_DE.ISO-8859-1', 'de-DE');
10+
echo str_ireplace(["\xE4", "\xF6", "\xFC"], ['1', '2', '3'], "\xE4\xC4 \xF6\xD6 \xFC\xDC") . PHP_EOL;
11+
?>
12+
--EXPECT--
13+
11 22 33

0 commit comments

Comments
 (0)