Bug #79617 [NEW]: mb_convert_case() with MB_CASE_TITLE unexpected behavior for second characters
| From: | dedienaar+phpnet at gmail dot com | 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