From ed97568b8a8786cb1b5fae9bdb02db1c9a48af76 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 7 Dec 2018 15:34:22 +0000 Subject: [PATCH] filter out invalid language values --- .../Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php | 5 ----- .../Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php index f0140814fad6c..687c0197ae5ed 100644 --- a/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php +++ b/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php @@ -30,11 +30,6 @@ public function loadChoicesForValues(array $values, $value = null) return array(); } - // If no callable is set, values are the same as choices - if (null === $value) { - return $values; - } - return $this->loadChoiceList($value)->getChoicesForValues($values); } diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php index 03e975dce1a24..12bfd74632f96 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Loader/IntlCallbackChoiceLoaderTest.php @@ -84,6 +84,11 @@ public function testLoadChoicesForValuesLoadsChoiceListOnFirstCall() ); } + public function testLoadChoicesForValuesDropsNonExistentChoices() + { + $this->assertSame(array(), self::$loader->loadChoicesForValues(array('foo'))); + } + public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall() { $this->assertSame(