Bug->Doc #70585 [Opn->Ver]: empty $locale is treated as default locale
| From: | cmb@php.net | Date: | Fri, 13 Aug 2021 15:24:04 +0000 |
| Subject: | Bug->Doc #70585 [Opn->Ver]: empty $locale is treated as default locale | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-19067@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70585&edit=1
ID: 70585
Updated by: cmb@php.net
Reported by: b8kich+php at gmail dot com
-Summary: getRegion should return null instead of defaulting
to 'US'
+Summary: empty $locale is treated as default locale
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
-Package: *Languages/Translation
+Package: intl
Operating System: GNU/Linux 2.6.32-358.18.1.el6.x8
PHP Version: 5.5.29
Block user comment: N
Private report: N
New Comment:
If an empty string is passed as $locale to any of the Locale
methods or their procedural counterparts, it acts as the default
locale[1]. The documentations mentions the behavior of an empty
string[2], but erroneously states that this would act as the root
locale.
[1] <https://github.com/php/php-src/blob/php-7.4.21/ext/intl/locale/locale_methods.c#L407-L410>
[2] <https://www.php.net/manual/en/class.locale.php>
Previous Comments:
------------------------------------------------------------------------
[2015-09-25 16:33:10] b8kich+php at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/locale.getregion
---
Return Values
The region subtag for the locale or NULL if not present
Test script:
---------------
$ php -r "echo Locale::getRegion(null);"
US
$ php -v
PHP 5.5.29 (cli) (built: Sep 9 2015 01:34:19
Expected result:
----------------
'' (null)
Actual result:
--------------
US
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70585&edit=1