|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-01 03:36 UTC] adam-phpbugs at adam dot gs
[2010-12-01 04:58 UTC] aharvey@php.net
-Status: Open
+Status: Bogus
[2010-12-01 04:58 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 02:00:01 2025 UTC |
Description: ------------ When given an invalid date/time both strtotime and the DateTime object returns the current day at midnight instead Test script: --------------- [adam@nighe]$ php -r '$x=strtotime("2011-00-00");printf("%s\n",date("Y-m-d H:i:s",$x));' 2010-11-30 00:00:00 [adam@nighe]$ php -r '$x=new DateTime("2011-00-00");var_dump($x);' object(DateTime)#1 (3) { ["date"]=> string(19) "2010-11-30 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "America/New_York" } Expected result: ---------------- returns current day at midnight Actual result: -------------- strtotime should return FALSE DateTime should throw an Exception.