ID: 45550 Updated by: [EMAIL PROTECTED] Reported By: jack+phpdotnet at smartertravelmedia dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: RHEL 4/5 PHP Version: 5.2.6 New Comment:
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. http://bugs.php.net/bug.php?id=42971 http://bugs.php.net/bug.php?id=44453 This is not a bug. MySQL is being silly to use this string as a default value. In PHP 5.3 you can now detect this however, by using date_parse_from_format( "Y-m-d H:i:s"); and then check the contents of date_get_last_errors(). Previous Comments: ------------------------------------------------------------------------ [2008-07-18 02:32:45] jack+phpdotnet at smartertravelmedia dot com updated subject to note that this is a backward-compatibility break. ------------------------------------------------------------------------ [2008-07-17 22:00:04] jack+phpdotnet at smartertravelmedia dot com Description: ------------ MySQL uses '0000-00-00 00:00:00' as a default value for non-null datetime fields. Until 5.2.6, strtotime correctly returned false (or -1 before 5.1) when passed this value - it's not a valid date/time. 5.2.6 returns '-62169966000' which is not useful. Reproduce code: --------------- <?php echo (int)strtotime('0000-00-00 00:00:00'); Expected result: ---------------- Should print 0. Actual result: -------------- Actually prints -62169966000. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45550&edit=1