Commit 20154df5 authored by Dries's avatar Dries

- 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
......@@ -1166,10 +1166,11 @@ function comment_validate($edit) {
// Invoke other validation handlers
comment_invoke_comment($edit, 'validate');
$check_date = strtotime($date);
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if ($check_date === FALSE || $check_date === -1) {
form_set_error('date', t('You have to specify a valid date.'));
if (isset($edit['date'])) {
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if (strtotime($edit['date']) <= 0) {
form_set_error('date', t('You have to specify a valid date.'));
}
}
if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) {
form_set_error('author', t('You have to specify a valid author.'));
......
......@@ -1166,10 +1166,11 @@ function comment_validate($edit) {
// Invoke other validation handlers
comment_invoke_comment($edit, 'validate');
$check_date = strtotime($date);
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if ($check_date === FALSE || $check_date === -1) {
form_set_error('date', t('You have to specify a valid date.'));
if (isset($edit['date'])) {
// As of PHP 5.1.0, strtotime returns FALSE upon failure instead of -1.
if (strtotime($edit['date']) <= 0) {
form_set_error('date', t('You have to specify a valid date.'));
}
}
if (isset($edit['author']) && !$account = user_load(array('name' => $edit['author']))) {
form_set_error('author', t('You have to specify a valid author.'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment