Skip to content

Commit

Permalink
Added check for array fields to be integers in reverseTransform metho…
Browse files Browse the repository at this point in the history
…d. This prevents checkdate from getting strings as arguments and throwing incorrect ErrorException when submitting form with malformed (string) data in, for example, Date field. #2609
  • Loading branch information
ondrowan committed Nov 11, 2011
1 parent ec047be commit 5eb496f
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -142,6 +142,10 @@ public function reverseTransform($value)
));
}

if (preg_match( '/^\d*$/', $value['month'] . $value['day'] . $value['year']) === 0) {
throw new TransformationFailedException('This is an invalid date');
}

if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) {
throw new TransformationFailedException('This is an invalid date');
}
Expand Down

0 comments on commit 5eb496f

Please sign in to comment.