bug #29501 [Form] filter out invalid language values (xabbuh)

This PR was merged into the 4.1 branch.

Discussion
----------

[Form] filter out invalid language values

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23679
| License       | MIT
| Doc PR        |

Commits
-------

ed97568b8a filter out invalid language values
This commit is contained in:
Nicolas Grekas 2018-12-08 16:43:38 +00:00
commit bcee8d91ac
2 changed files with 5 additions and 5 deletions

View File

@ -30,11 +30,6 @@ class IntlCallbackChoiceLoader extends CallbackChoiceLoader
return array();
}
// If no callable is set, values are the same as choices
if (null === $value) {
return $values;
}
return $this->loadChoiceList($value)->getChoicesForValues($values);
}

View File

@ -84,6 +84,11 @@ class IntlCallbackChoiceLoaderTest extends TestCase
);
}
public function testLoadChoicesForValuesDropsNonExistentChoices()
{
$this->assertSame(array(), self::$loader->loadChoicesForValues(array('foo')));
}
public function testLoadValuesForChoicesLoadsChoiceListOnFirstCall()
{
$this->assertSame(