8000 [Form] fixed previous merge · proofek/symfony@0427b12 · GitHub
[go: up one dir, main page]

Skip to conten 8000 t

Commit 0427b12

Browse files
committed
[Form] fixed previous merge
1 parent 3922fb8 commit 0427b12

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,16 @@ public function reverseTransform($value)
142142
));
143143
}
144144

145-
if (!ctype_digit($value['month'].$value['day'].$value['year'])) {
146-
throw new TransformationFailedException('This is an invalid date');
145+
if (isset($value['month']) && !ctype_digit($value['month'])) {
146+
throw new TransformationFailedException('This month an invalid');
147+
}
148+
149+
if (isset($value['day']) && !ctype_digit($value['day'])) {
150+
throw new TransformationFailedException('This day an invalid');
151+
}
152+
153+
if (isset($value['year']) && !ctype_digit($value['year'])) {
154+
throw new TransformationFailedException('This year an invalid');
147155
}
148156

149157
if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) {

0 commit comments

Comments
 (0)
0