File tree 2 files changed +8
-1
lines changed
src/Symfony/Component/Form 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ public function getChoicesForValues(array $values)
141
141
$ choices = array ();
142
142
143
143
foreach ($ values as $ i => $ givenValue ) {
144
- if (isset ( $ this ->choices [ $ givenValue ] )) {
144
+ if (array_key_exists ( $ givenValue , $ this ->choices )) {
145
145
$ choices [$ i ] = $ this ->choices [$ givenValue ];
146
146
}
147
147
}
Original file line number Diff line number Diff line change @@ -130,4 +130,11 @@ public function testCompareChoicesByIdentityByDefault()
130
130
$ this ->assertSame (array (2 => 'value2 ' ), $ choiceList ->getValuesForChoices (array (2 => $ obj2 )));
131
131
$ this ->assertSame (array (2 => 'value2 ' ), $ choiceList ->getValuesForChoices (array (2 => (object ) array ('value ' => 'value2 ' ))));
132
132
}
133
+
134
+ public function testGetChoicesForValuesWithContainingNull ()
135
+ {
136
+ $ choiceList = new ArrayChoiceList (array ('Null ' => null ));
137
+
138
+ $ this ->assertSame (array (0 => null ), $ choiceList ->getChoicesForValues (array ('0 ' )));
139
+ }
133
140
}
You can’t perform that action at this time.
0 commit comments