Skip to content

Commit

Permalink
Patched src/Symfony/Component/Form/Extension/Core/DataTransformer/Dat…
Browse files Browse the repository at this point in the history
…eTimeToArrayTransformer.php to throw an exception when an invalid date is passed for transformation (e.g. 31st February)
  • Loading branch information
mdavis1982 authored and stloyd committed Jul 28, 2011
1 parent cae81a7 commit 340b528
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
Expand Up @@ -142,6 +142,10 @@ public function reverseTransform($value)
));
}

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

try {
$dateTime = new \DateTime(sprintf(
'%s-%s-%s %s:%s:%s %s',
Expand Down

0 comments on commit 340b528

Please sign in to comment.