소스 검색

[Form] fixed previous merge

Fabien Potencier 13 년 전
부모
커밋
0427b126c1
1개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 10 2
      src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

+ 10 - 2
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

@@ -142,8 +142,16 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
             ));
         }
 
-        if (!ctype_digit($value['month'].$value['day'].$value['year'])) {
-            throw new TransformationFailedException('This is an invalid date');
+        if (isset($value['month']) && !ctype_digit($value['month'])) {
+            throw new TransformationFailedException('This month an invalid');
+        }
+
+        if (isset($value['day']) && !ctype_digit($value['day'])) {
+            throw new TransformationFailedException('This day an invalid');
+        }
+
+        if (isset($value['year']) && !ctype_digit($value['year'])) {
+            throw new TransformationFailedException('This year an invalid');
         }
 
         if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) {