Skip to content
Snippets Groups Projects
Commit 20154df5 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Modified patch #45723 by wtanaka: creating a comment, editing a comment, or...

- Modified patch #45723 by wtanaka: creating a comment, editing a comment, or anything that validates a comment fails on PHP5.
parent 017cbf5e
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -1166,10 +1166,11 @@ function comment_validate($edit) { ...@@ -1166,10 +1166,11 @@ function comment_validate($edit) {
// Invoke other validation handlers // Invoke other validation handlers
comment_invoke_comment($edit, 'validate'); comment_invoke_comment($edit, 'validate');
$check_date = strtotime($date); if (isset($edit['date'])) {
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1. // As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if ($check_date === FALSE || $check_date === -1) { if (strtotime($edit['date']) <= 0) {
form_set_error('date', t('You have to specify a valid date.')); form_set_error('date', t('You have to specify a valid date.'));
}
} }
if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) { if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) {
form_set_error('author', t('You have to specify a valid author.')); form_set_error('author', t('You have to specify a valid author.'));
......
...@@ -1166,10 +1166,11 @@ function comment_validate($edit) { ...@@ -1166,10 +1166,11 @@ function comment_validate($edit) {
// Invoke other validation handlers // Invoke other validation handlers
comment_invoke_comment($edit, 'validate'); comment_invoke_comment($edit, 'validate');
$check_date = strtotime($date); if (isset($edit['date'])) {
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1. // As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if ($check_date === FALSE || $check_date === -1) { if (strtotime($edit['date']) <= 0) {
form_set_error('date', t('You have to specify a valid date.')); form_set_error('date', t('You have to specify a valid date.'));
}
} }
if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) { if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) {
form_set_error('author', t('You have to specify a valid author.')); form_set_error('author', t('You have to specify a valid author.'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment