diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index d8a6e38174b35..597964c7e7974 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -523,6 +523,8 @@ public function isSubmittedWithExtraFields() */ public function isValid() { + $this->validate(); + if (!parent::isValid()) { return false; } @@ -749,9 +751,7 @@ public function bind(Request $request, $data = null) $values = $request->request->get($this->getName(), array()); $files = $request->files->get($this->getName(), array()); - $this->submit(self::deepArrayUnion($values, $files)); - - $this->validate(); + $this->submit(array_replace_recursive($values, $files)); } } @@ -940,25 +940,4 @@ public function isEmpty() return true; } - - /** - * Merges two arrays without reindexing numeric keys. - * - * @param array $array1 An array to merge - * @param array $array2 An array to merge - * - * @return array The merged array - */ - static protected function deepArrayUnion($array1, $array2) - { - foreach ($array2 as $key => $value) { - if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) { - $array1[$key] = self::deepArrayUnion($array1[$key], $value); - } else { - $array1[$key] = $value; - } - } - - return $array1; - } }