From 8d99d7561b5a1055032e4236630bd1fa25d42ef3 Mon Sep 17 00:00:00 2001 From: Ian Jenkins Date: Thu, 27 Feb 2014 22:38:05 +0000 Subject: [PATCH] [Form][2.3] Fixes empty file-inputs getting treated as extra field. --- src/Symfony/Component/Form/Form.php | 2 +- src/Symfony/Component/Form/Tests/CompoundFormTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 86cf7921a1fe..5d16f9ca0254 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -556,7 +556,7 @@ public function submit($submittedData, $clearMissing = true) } foreach ($this->children as $name => $child) { - if (isset($submittedData[$name]) || $clearMissing) { + if (array_key_exists($name, $submittedData) || $clearMissing) { $child->submit(isset($submittedData[$name]) ? $submittedData[$name] : null, $clearMissing); unset($submittedData[$name]); diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index fe3755c1720a..565b6ce646d4 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -115,7 +115,7 @@ public function testSubmitDoesNotAddExtraFieldForNullValues() $child = $factory->create('file', null, array('auto_initialize' => false)); $this->form->add($child); - $this->form->submit(array('file' => null)); + $this->form->submit(array('file' => null), false); $this->assertCount(0, $this->form->getExtraData()); }