Created
August 9, 2011 15:28
-
-
Save SeanJA/1134361 to your computer and use it in GitHub Desktop.
node.module patch to fix date check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- node.module 2011-08-09 10:36:01.000000000 -0300 | |
| +++ node.module 2011-08-09 12:25:13.000000000 -0300 | |
| @@ -803,9 +803,10 @@ | |
| // are dealing with an anonymous user we set the user ID to 0. | |
| form_set_error('name', t('The username %name does not exist.', array('%name' => $node->name))); | |
| } | |
| - | |
| + $strtotime = strtotime($node->date); | |
| // Validate the "authored on" field. As of PHP 5.1.0, strtotime returns FALSE instead of -1 upon failure. | |
| - if (!empty($node->date) && strtotime($node->date) <= 0) { | |
| + // 0 is a perfectly valid date, so check for false and -1 instead of <= 0 | |
| + if (!empty($node->date) && ($strtotime === false || $strtotime === -1) ) { | |
| form_set_error('date', t('You have to specify a valid date.')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment