From 835aa788d46b1b91e69610837116ecd2f8ec7aa6 Mon Sep 17 00:00:00 2001 From: Abdellatif Ait boudad Date: Mon, 31 Aug 2015 16:16:04 +0000 Subject: [PATCH 1/2] [Form][2.7][ Choice type] fixed groups with empty array. --- .../Form/ChoiceList/Factory/DefaultChoiceListFactory.php | 4 ++++ .../Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php b/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php index 9e54fa0857..b227180100 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php @@ -172,6 +172,10 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface private static function addChoiceViewsGroupedBy($groupBy, $label, $choices, $keys, &$index, $attr, $isPreferred, &$preferredViews, &$otherViews) { foreach ($groupBy as $key => $value) { + if (null === $value) { + continue; + } + // Add the contents of groups to new ChoiceGroupView instances if (is_array($value)) { $preferredViewsForGroup = array(); diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php index 1738aaff0f..9210bc3d70 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php @@ -536,6 +536,7 @@ class DefaultChoiceListFactoryTest extends \PHPUnit_Framework_TestCase $list = new ArrayChoiceList(array( 'Group 1' => array('A' => $this->obj1, 'B' => $this->obj2), 'Group 2' => array('C' => $this->obj3, 'D' => $this->obj4), + 'Group empty' => array(), )); $view = $this->factory->createView( From 2c4860877d13652e9c424629ec9a51a4ab876fa6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 1 Sep 2015 15:39:59 +0200 Subject: [PATCH 2/2] Require symfony/intl ~2.4 when Locale::setDefault() is used --- src/Symfony/Component/Form/composer.json | 2 +- src/Symfony/Component/Translation/composer.json | 2 +- src/Symfony/Component/Validator/composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json index 21c6af6799..3894b6b45d 100644 --- a/src/Symfony/Component/Form/composer.json +++ b/src/Symfony/Component/Form/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.9", "symfony/event-dispatcher": "~2.1", - "symfony/intl": "~2.3", + "symfony/intl": "~2.4", "symfony/options-resolver": "~2.6", "symfony/property-access": "~2.3" }, diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json index 6f1053e66c..e2e1587e0a 100644 --- a/src/Symfony/Component/Translation/composer.json +++ b/src/Symfony/Component/Translation/composer.json @@ -21,7 +21,7 @@ "require-dev": { "symfony/phpunit-bridge": "~2.7", "symfony/config": "~2.7", - "symfony/intl": "~2.3", + "symfony/intl": "~2.4", "symfony/yaml": "~2.2", "psr/log": "~1.0" }, diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index b89fe1b134..5881064ea4 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -22,7 +22,7 @@ "require-dev": { "symfony/phpunit-bridge": "~2.7", "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", + "symfony/intl": "~2.4", "symfony/yaml": "~2.0,>=2.0.5", "symfony/config": "~2.2", "symfony/property-access": "~2.3",