yiisoft/yii — pull request #2431 by Rupert-RR (2013-04-30 18:05:07+00:00)
Title: Fixes issue #2429 - use a stable sort when sorting Accept and Accept-Language headers.

Fixes issue #2429 by adding the class methods `parseAcceptLanguagesHeader()` and `compareAcceptLanguages()` as the equivalents of the existing `parseAcceptHeader()` and `compareAcceptTypes()`, and the instance method `getAcceptLanguages()` as the equivalent of the existing `getAcceptTypes()`.
Modified the `parseAcceptHeader()` method to include the original `array` position in the resulting accept types `array map`.
Modified the `compareAcceptTypes()` method to take into account the original position of the items when comparing is equal on all other counts.
Modified the existing `getPreferredLanguages()` method to function in the same way as the `getPreferredAcceptTypes()` method, and modified the `getPreferredLanguage()` method to correctly interpret the resulting `array` of `array maps` (rather than `array` of language strings as previously), so that these changes should be transparent to anyone using this function.
Updated the unit tests for the `parseAcceptHeader()` and `compareAcceptTypes()` methods and added tests for the new `parseAcceptLanguagesHeader()` and `compareAcceptLanguages()` methods.