|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48574 Locale::lookup modifies matching tag
Submitted: 2009-06-16 19:23 UTC Modified: 2009-07-02 00:44 UTC
From: a dot schilder at gmx dot de Assigned: stas (profile)
Status: Closed Package: I18N and L10N related
PHP Version: 5.3.0RC3 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: a dot schilder at gmx dot de
New email:
PHP Version: OS:


 [2009-06-16 19:23 UTC] a dot schilder at gmx dot de
The documentation says that the return value of Locale::lookup is "The closest matching language tag or default value.", but the matching tag is modified.

The result of the example below doesn't match the searched (en_US) nor the matched (en-us) tag, but is totally different (en_us).

Reproduce code:

$languages = array("en", "en-us");
echo Locale::lookup($languages, 'en_US', 'en_UK');


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-24 06:41 UTC] a dot schilder at gmx dot de
Email changed
 [2009-07-02 00:10 UTC]
Docs are wrong, it should be:

echo Locale::lookup($languages, 'en_US', false, 'en_UK');

But there's also a bug in lookup, will fix it.
 [2009-07-02 00:44 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 22 01:04:22 2022 UTC