Skip to content

Fix #79986: str_ireplace bug with diacritics characters #6007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -3156,7 +3156,7 @@ static zend_string* php_char_to_str_ex(zend_string *str, char from, char *to, si
{
zend_string *result;
size_t char_count = 0;
char lc_from = 0;
int lc_from = 0;
const char *source, *source_end= ZSTR_VAL(str) + ZSTR_LEN(str);
char *target;

Expand Down
13 changes: 13 additions & 0 deletions ext/standard/tests/strings/bug79986.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Bug #79986 (str_ireplace bug with diacritics characters)
--SKIPIF--
<?php
if (!setlocale(LC_ALL, 'de_DE.ISO-8859-1', 'de-DE')) die('skip German locale not available');
?>
--FILE--
<?php
setlocale(LC_ALL, 'de_DE.ISO-8859-1', 'de-DE');
echo str_ireplace(["\xE4", "\xF6", "\xFC"], ['1', '2', '3'], "\xE4\xC4 \xF6\xD6 \xFC\xDC") . PHP_EOL;
?>
--EXPECT--
11 22 33