File tree 2 files changed +24
-1
lines changed
src/Symfony/Component/Form
Extension/Core/EventListener
Tests/Extension/Core/Type
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public function onBindClientData(FilterDataEvent $event)
41
41
$ values = (array ) $ event ->getData ();
42
42
$ indices = $ this ->choiceList ->getIndicesForValues ($ values );
43
43
44
- $ event ->setData (array_combine ($ indices , $ values ));
44
+ $ event ->setData (count ( $ indices ) > 0 ? array_combine ($ indices , $ values) : array ( ));
45
45
}
46
46
47
47
static public function getSubscribedEvents ()
Original file line number Diff line number Diff line change @@ -399,6 +399,29 @@ public function testBindMultipleExpanded()
399
399
$ this ->assertNull ($ form [4 ]->getClientData ());
400
400
}
401
401
402
+ public function testBindMultipleExpandedEmpty ()
403
+ {
404
+ $ form = $ this ->factory ->create ('choice ' , null , array (
405
+ 'multiple ' => true ,
406
+ 'expanded ' => true ,
407
+ 'choices ' => $ this ->choices ,
408
+ ));
409
+
410
+ $ form ->bind (array ());
411
+
412
+ $ this ->assertSame (array (), $ form ->getData ());
413
+ $ this ->assertFalse ($ form [0 ]->getData ());
414
+ $ this ->assertFalse ($ form [1 ]->getData ());
415
+ $ this ->assertFalse ($ form [2 ]->getData ());
416
+ $ this ->assertFalse ($ form [3 ]->getData ());
417
+ $ this ->assertFalse ($ form [4 ]->getData ());
418
+ $ this ->assertNull ($ form [0 ]->getClientData ());
419
+ $ this ->assertNull ($ form [1 ]->getClientData ());
420
+ $ this ->assertNull ($ form [2 ]->getClientData ());
421
+ $ this ->assertNull ($ form [3 ]->getClientData ());
422
+ $ this ->assertNull ($ form [4 ]->getClientData ());
423
+ }
424
+
402
425
public function testBindMultipleExpandedWithEmptyField ()
403
426
{
404
427
$ form = $ this ->factory ->create ('choice ' , null , array (
You can’t perform that action at this time.
0 commit comments