Skip to content

Commit

Permalink
[Form] fixed previous merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Nov 11, 2011
1 parent a98192e commit 78fa493
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
Expand Up @@ -142,8 +142,16 @@ public function reverseTransform($value)
));
}

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'])) {
Expand Down

0 comments on commit 78fa493

Please sign in to comment.