From c0bcd301d3661c6e2efeae1fdc823406114f6430 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 23 Jul 2017 15:00:26 +0200 Subject: [PATCH] Another fix for bug #69267 mb_strtoupper() was converting lowercase characters into titlecase characters, instead of uppercase characters. Luckily there are only very few characters with a distinct titlecase representation, so this mostly worked out okay... --- ext/mbstring/php_unicode.c | 2 +- ext/mbstring/tests/bug69267.phpt | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c index 9771289cd0..485988fe35 100644 --- a/ext/mbstring/php_unicode.c +++ b/ext/mbstring/php_unicode.c @@ -173,7 +173,7 @@ MBSTRING_API unsigned long php_unicode_toupper(unsigned long code, enum mbfl_no_ /* * The character is lower case. */ - field = 2; + field = 1; l = _uccase_len[0]; r = (l + _uccase_len[1]) - 1; diff --git a/ext/mbstring/tests/bug69267.phpt b/ext/mbstring/tests/bug69267.phpt index c00e5e129a..8d429411ac 100644 --- a/ext/mbstring/tests/bug69267.phpt +++ b/ext/mbstring/tests/bug69267.phpt @@ -2,8 +2,26 @@ Bug #69267: mb_strtolower fails on titlecase characters --FILE-- --EXPECT-- string(8) "džljnjdz" +string(8) "džljnjdz" +string(8) "džljnjdz" +string(8) "DŽLJNJDZ" +string(8) "DŽLJNJDZ" +string(8) "DŽLJNJDZ" +string(8) "Džljnjdz" +string(8) "Džljnjdz" +string(8) "Džljnjdz" -- 2.40.0