Bug #79197 [NEW]: Intl class does not for some locales (maybe fallback option bug)

From: Date: Thu, 30 Jan 2020 09:36:03 +0000
Subject: Bug #79197 [NEW]: Intl class does not for some locales (maybe fallback option bug)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225244@lists.php.net to get a copy of this message
From: salarmehr at gmail dot com Operating system: Windows/Linux PHP version: 7.3.14 Package: I18N and L10N related Bug Type: Bug Bug description:Intl class does not for some locales (maybe fallback option bug) Description: ------------ Trying to get the language name from the language code, I run ``` $bundle = \ResourceBundle::create('en_UK', 'ICUDATA-lang', true); $lang = $bundle->get('Languages')->get('fr'); var_dump($lang); $bundle = \ResourceBundle::create('en_US', 'ICUDATA-lang', true); $lang = $bundle->get('Languages')->get('fr'); var_dump($lang); $bundle = \ResourceBundle::create('en_foobar', 'ICUDATA-lang', true); $lang = $bundle->get('Languages')->get('fr'); var_dump($lang); $bundle = \ResourceBundle::create('en_NZ', 'ICUDATA-lang', true); $lang = $bundle->get('Languages')->get('fr'); var_dump($lang); $bundle = \ResourceBundle::create('en_AU', 'ICUDATA-lang', true); $lang = $bundle->get('Languages')->get('fr'); var_dump($lang); ``` ``` string(6) "French" string(6) "French" string(6) "French" NULL NULL ``` It returns null for Australia and New Zealand that indicates an Intl error of > Cannot load resource element 'fr': U_MISSING_RESOURCE_ERROR" The third parameter of \ResourceBundle::create functions is for call back that means it should fallback to its parent locale. Interestingly the [parent locale of en_AU][1] is en_001. Similarly, this happens for currency names [1]: https://github.com/unicode-org/icu/blob/release-65-1/icu4c/source/data/lang/en_AU.txt Test script: --------------- $bundle = \ResourceBundle::create('en_AU', 'ICUDATA-lang', true); $lang = $bundle->get('Languages')->get('fr'); var_dump($lang); Expected result: ---------------- string(6) "French" Actual result: -------------- NULL -- Edit bug report at https://bugs.php.net/bug.php?id=79197&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79197&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79197&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79197&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79197&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79197&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79197&r=support Expected behavior: https://bugs.php.net/fix.php?id=79197&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79197&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79197&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79197&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79197&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79197&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79197&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79197&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79197&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79197&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79197&r=mysqlcfg

« previous php.bugs (#225244) next »