merged branch stealth35/patch-18 (PR #3542)
Commits
-------
7aad478
[Locale] Prevent empty bundle
Discussion
----------
[Locale] Prevent empty bundle
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/stealth35/symfony.png?branch=patch-18)](http://travis-ci.org/stealth35/symfony)
Fixes the following tickets: #3486
Todo: -
This commit is contained in:
commit
85000fc288
@ -51,8 +51,9 @@ class Locale extends \Locale
|
||||
|
||||
$collator = new \Collator($locale);
|
||||
$countries = array();
|
||||
$bundleCountries = $bundle->get('Countries') ?: array();
|
||||
|
||||
foreach ($bundle->get('Countries') as $code => $name) {
|
||||
foreach ($bundleCountries as $code => $name) {
|
||||
// Global countries (f.i. "America") have numeric codes
|
||||
// Countries have alphabetic codes
|
||||
// "ZZ" is the code for unknown country
|
||||
@ -105,8 +106,9 @@ class Locale extends \Locale
|
||||
|
||||
$collator = new \Collator($locale);
|
||||
$languages = array();
|
||||
$bundleLanguages = $bundle->get('Languages') ?: array();
|
||||
|
||||
foreach ($bundle->get('Languages') as $code => $name) {
|
||||
foreach ($bundleLanguages as $code => $name) {
|
||||
// "mul" is the code for multiple languages
|
||||
if ('mul' !== $code) {
|
||||
$languages[$code] = $name;
|
||||
@ -155,8 +157,9 @@ class Locale extends \Locale
|
||||
|
||||
$collator = new \Collator($locale);
|
||||
$locales = array();
|
||||
$bundleLocales = $bundle->get('Locales') ?: array();
|
||||
|
||||
foreach ($bundle->get('Locales') as $code => $name) {
|
||||
foreach ($bundleLocales as $code => $name) {
|
||||
$locales[$code] = $name;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user