10000 Added check for array fields to be integers in reverseTransform method. ... by ondrowan · Pull Request #2610 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Added check for array fields to be integers in reverseTransform method. ... #2610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added check for array fields to be integers in reverseTransform metho…
…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
commit 92f9e758a8e689fad48a52748173840366ecc44f
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ public function reverseTransform($value)
sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields)
));
}

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