Commit 84093ae
committed
bug #46576 Fix choice filter error when loading mix of grouped and non-grouped choices (BreyndotEchse)
This PR was merged into the 5.4 branch.
Discussion
----------
Fix choice filter error when loading mix of grouped and non-grouped choices
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
**How to reproduce this bug:**
```php
$choiceType = $builder->create('test', ChoiceType::class, [
'choice_loader' => new CallbackChoiceLoader(fn() => [
'Foo',
'Optgroup' => [
'Bar',
'Baz',
],
]),
'choice_filter' => fn() => true,
]);
$choiceType->getForm()->createView();
```
**TypeError:**
```
Argument 1 passed to Symfony\Component\Form\ChoiceList\ArrayChoiceList::getChoicesForValues() must be of the type array, string given, called in ~/symfony/form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php on line 39
```
Commits
-------
24c65bf8a8 Fix choice filter error when loading mix of grouped and non-grouped choicesFile tree
2 files changed
+33
-3
lines changed- ChoiceList/Loader
- Tests/ChoiceList/Loader
2 files changed
+33
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | | - | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
50 | 73 | | |
51 | 74 | | |
52 | 75 | | |
| |||
0 commit comments