Skip to content

Commit c925028

Browse files
committed
Merge branch 'PHP-7.4' into master
* PHP-7.4: Fix #79986: str_ireplace bug with diacritics characters
2 parents 08d2e51 + 5ab7b30 commit c925028

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2897,7 +2897,7 @@ static zend_string* php_char_to_str_ex(zend_string *str, char from, char *to, si
28972897
{
28982898
zend_string *result;
28992899
size_t char_count = 0;
2900-
char lc_from = 0;
2900+
int lc_from = 0;
29012901
const char *source, *source_end= ZSTR_VAL(str) + ZSTR_LEN(str);
29022902
char *target;
29032903

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)