Bug #79617 [NEW]: mb_convert_case() with MB_CASE_TITLE unexpected behavior for second characters

From: Date: Thu, 21 May 2020 17:41:09 +0000
Subject: Bug #79617 [NEW]: mb_convert_case() with MB_CASE_TITLE unexpected behavior for second characters
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227113@lists.php.net to get a copy of this message
From: dedienaar+phpnet at gmail dot com Operating system: Ubuntu 18.04.4 LTS PHP version: 7.2.31 Package: *Unicode Issues Bug Type: Bug Bug description:mb_convert_case() with MB_CASE_TITLE unexpected behavior for second characters Description: ------------ This relates to: - https://www.php.net/manual/en/function.mb-convert-case - https://github.com/php/php-src/blob/35e0a91db717fe441a89ca9554d8843d8ee63112/ext/mbstring/mbstring.c#L2674-L2709 - https://github.com/laravel/framework/issues/32910 The function mb_convert_case() unfortunately does not take apostrophes, quotes and certain other special characters into consideration when converting case using MB_CASE_TITLE. Test script: --------------- >>> var_dump(mb_convert_case('al-fātiḥah', MB_CASE_TITLE, >>> 'UTF-8')); => string(13) "Al-Fātiḥah" // <-- GOOD >>> var_dump(mb_convert_case('AL-FĀTIḤAH', MB_CASE_TITLE, >>> 'UTF-8')); => string(13) "Al-Fātiḥah" // <-- GOOD >>> var_dump(mb_convert_case('ʾāli-ʿimrān', MB_CASE_TITLE, 'UTF-8')); => string(15) "ʾāli-ʿimrān" // <-- NOT GOOD: Not uppercased 'Ā' and 'I' due to preceding ʾ and ʿ >>> var_dump(mb_convert_case('ʾĀLI-ʿIMRĀN', MB_CASE_TITLE, 'UTF-8')); => string(15) "ʾāli-ʿimrān" // <-- NOT GOOD: Lowercased 'Ā' and 'I' due to preceding ʾ and ʿ >>> var_dump(mb_convert_case('aṣ-ṣāffāt', MB_CASE_TITLE, 'UTF-8')); => string(15) "Aṣ-Ṣāffāt" // GOOD >>> var_dump(mb_convert_case('AṢ-ṢĀFFĀT', MB_CASE_TITLE, 'UTF-8')); => string(15) "Aṣ-Ṣāffāt" // GOOD >>> var_dump(mb_convert_case('ṭāʾ hāʾ', MB_CASE_TITLE, >>> 'UTF-8')); => string(13) "Ṭāʾ Hāʾ" // GOOD >>> var_dump(mb_convert_case('ṬĀʾ HĀʾ', MB_CASE_TITLE, >>> 'UTF-8')); => string(13) "Ṭāʾ Hāʾ" // GOOD >>> var_dump(mb_convert_case('ʾibrāhīm', MB_CASE_TITLE, >>> 'UTF-8')); => string(11) "ʾibrāhīm" // <-- NOT GOOD: Lowercased 'I' due to preceding ʾ >>> var_dump(mb_convert_case('ʾIBRĀHĪM', MB_CASE_TITLE, >>> 'UTF-8')); => string(11) "ʾibrāhīm" // <-- NOT GOOD: Lowercased 'I' due to preceding ʾ >>> var_dump(mb_convert_case('\'ibrāhīm', MB_CASE_TITLE, >>> 'UTF-8')); => string(10) "'ibrāhīm" // <-- NOT GOOD: Lowercased 'I' due to preceding apostrophe >>> var_dump(mb_convert_case('`ibrāhīm', MB_CASE_TITLE, >>> 'UTF-8')); => string(10) "`ibrāhīm" // <-- NOT GOOD: Lowercased 'I' due to preceding backtick >>> var_dump(mb_convert_case('"ibrāhīm', MB_CASE_TITLE, >>> 'UTF-8')); => string(10) ""ibrāhīm" // <-- Wrongly lowercased 'I' due to preceding quote -- Edit bug report at https://bugs.php.net/bug.php?id=79617&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79617&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79617&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79617&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79617&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79617&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79617&r=support Expected behavior: https://bugs.php.net/fix.php?id=79617&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79617&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79617&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79617&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79617&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79617&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79617&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79617&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79617&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79617&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79617&r=mysqlcfg

« previous php.bugs (#227113) next »