ZF-3785: Zend_Locale get wrong result for the language settings.
Description
array_merge was replaced by the operator + but the merge parameters were reversed causing lesser priority language settings to override the most important ones.
<?php require_once 'Zend/Locale.php';
$locale = new Zend_Locale();
$language = setlocale(LC_ALL, 0);
$httplanguages = getenv('HTTP_ACCEPT_LANGUAGE');
echo ($language), '
';
echo ($httplanguages), '
';
print_r($locale->getBrowser());
echo <<
Note
I'm getting this: LC_COLLATE=C;LC_CTYPE=English_United States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C fr-fr,fr;q=0.8,en-us;q=0.6,en;q=0.4,ja;q=0.2 Array ( [en] => 1 [fr_FR] => 1 [fr] => 1 [en_US] => 0.6 [ja] => 0.2 )
But I'm excpeting that: LC_COLLATE=C;LC_CTYPE=English_United States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C fr-fr,fr;q=0.8,en-us;q=0.6,en;q=0.4,ja;q=0.2 Array ( [fr_FR] => 1 [fr] => 1 [en_US] => 0.6 [en] => 0.6 [ja] => 0.2 )
PS: I also wonder why the qualities are not preserved: [fr_FR] should be 0.8 and [en] 0.4 Is it done on purpose? END;
Comments
Posted by Sébastien Gallet (haijin) on 2008-07-28T22:28:15.000+0000
Here the fix for that bug.
Posted by Thomas Weidner (thomas) on 2008-07-28T23:17:14.000+0000
Please give example code and LC setting to show your problem. Actually the unittests run through without showing problems and they are using multiple locales to test the priority.
Posted by Thomas Weidner (thomas) on 2008-08-08T13:59:23.000+0000
The issue has been fixed for the trunk. Not sure for RC2 as I18N changes have been put on hold until 1.7 due to BC problems.