Bug #45647 [Com]: strtotime() returning 1999-11-30 for 00-00-00 00:00:00

From: Date: Sat, 23 Jan 2016 10:18:04 +0000
Subject: Bug #45647 [Com]: strtotime() returning 1999-11-30 for 00-00-00 00:00:00
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198842@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45647&edit=1 ID: 45647 Comment by: senz at senz dot su Reported by: jon dot reed at jellyfish dot co dot uk Summary: strtotime() returning 1999-11-30 for 00-00-00 00:00:00 Status: Not a bug Type: Bug Package: Date/time related Operating System: Centos 5.1 PHP Version: 5.2.6 Block user comment: N Private report: N New Comment: @Derick, you are inconsistent with your opinion: https://bugs.php.net/bug.php?id=30190 and your logic is not obvious for end user, nor properly documented. Also look at this comment http://php.net/manual/en/function.strtotime.php#101702 IMHO year 0 should be considered as error, as in previous versions. Since this is BC issue. Alto this case is rare, but very misleading for inexperienced developer, when one's dev and production archs differs. Previous Comments: ------------------------------------------------------------------------ [2008-07-28 19:17:55] derick@php.net There is no bug here, 00-00-00 means 2000-00-00, which is 1999-12-00, which is 1999-11-30. No bug, perfectly normal. ------------------------------------------------------------------------ [2008-07-28 16:40:58] jon dot reed at jellyfish dot co dot uk Description: ------------ As per bug #41523 which is reported fixed on Vista. We're running a custom build RPM of 5.2.6 It looks like this bug has reappeared: $incorrect = '1999-11-30'; $time = date('Y-m-d',strtotime('00-00-00 00:00:00')); $this->assertNotEqual($time, $incorrect); This fails SimpleTest. php -r "echo date('Y-m-d',strtotime('00-00-00 00:00:00'));" 1999-11-30 Reproduce code: --------------- echo strtotime('00-00-00 00:00:00'); Expected result: ---------------- -1 Actual result: -------------- 943920000 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=45647&edit=1

« previous php.bugs (#198842) next »