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

Here the fix for that bug.

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.

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.