|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 - 14 = ?
Subscribe to this entry?

 [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: Tue Jan 25 09:03:34 2022 UTC