Edit report at https://bugs.php.net/bug.php?id=55252&edit=1
ID: 55252 Updated by: [email protected] Reported by: cm at fuf dot de Summary: On 64 bit strtotime() mishandles all-zero timestamps -Status: Open +Status: Duplicate Type: Bug Package: Date/time related Operating System: Linux 2.6.38 amd64 PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: This is completely valid, per strtotime()'s documented behaviour: invalid components within date strings are conformed as best as they can be, and in that case, you've basically asked for the last day in November in the year -1 (effectively 2 BC). Closing duplicate, as this has previously been dealt with in bug #53662. Previous Comments: ------------------------------------------------------------------------ [2011-07-20 11:35:53] cm at fuf dot de Description: ------------ The behavior of strtotime() on 64 bit machines (see below) for all-zero timestamps is undesirable. On 32 bit machines the function outputs NULL for a string input "0000-00-00 00:00", on 64 bit machines it yields -62169987600. This is undesirable, as the all-zero timestamp is not a valid date ("00" is not a month). On 64 bit systems strtotime() should return NULL for "0000-00-00 00:00". Test script: --------------- /* Linux ubuntu64-vbox 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC * 2011 x86_64 x86_64 x86_64 GNU/Linux * PHP 5.3.6-6~dotdeb.1 with Suhosin-Patch (cli) (built: Apr 3 2011 16:36:05) */ <?php echo strtotime("0000-00-00 00:00"); ?> Actual result: -------------- -62169987600 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55252&edit=1
