#45550 [Opn]: BC break: strtotime parses 0000-00-00 00:00:00 as valid date in 5.2.6
| From: | jack+phpdotnet at smartertravelmedia dot com | Date: | Fri, 18 Jul 2008 02:32:46 +0000 |
| Subject: | #45550 [Opn]: BC break: strtotime parses 0000-00-00 00:00:00 as valid date in 5.2.6 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126929@lists.php.net to get a copy of this message | ||
ID: 45550
User updated by: jack+phpdotnet at smartertravelmedia dot com
-Summary: strtotime parses 0000-00-00 00:00:00 as valid date
Reported By: jack+phpdotnet at smartertravelmedia dot com
Status: Open
Bug Type: Date/time related
Operating System: RHEL 4/5
PHP Version: 5.2.6
New Comment:
updated subject to note that this is a backward-compatibility break.
Previous Comments:
------------------------------------------------------------------------
[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