|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40340 Creating a DateTime object using a string that is invalid due to DST transition
Submitted: 2007-02-03 04:27 UTC Modified: 2008-11-10 01:00 UTC
Avg. Score:3.8 ± 1.6
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: kal at kalunite dot net Assigned: derick (profile)
Status: No Feedback Package: Date/time related
PHP Version: 5.2.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kal at kalunite dot net
New email:
PHP Version: OS:


 [2007-02-03 04:27 UTC] kal at kalunite dot net
You can create an invalid DateTime object by giving it a string in the GNU Date Input Format syntax. 

For instance, '2006-04-02 02:05:00 America/New_York' is supposed to be invalid because DST takes effect on that day, such that all times >= 02:00:00 and < 03:00:00 are supposed to be invalid. Trying to create a DateTime object with that string is supposed to return FALSE.

The bug is probably not caused by an outdated timezone database because the timezone database in use is version 2006.14.

I could not test for the bug in the latest snapshot because the latest snapshot crashes Apache2 on my machine( and that's a different story).

Reproduce code:
$foo = date_create('2006-04-02 02:05:00 America/New_York');
  echo $foo->format('Y-m-d H:i:s e'),$foo->format('I')?' DST':'';
  echo "FALSE";

Expected result:

Actual result:
2006-04-02 02:05:00 America/New_York DST


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-02 12:40 UTC]
Please try using this CVS snapshot:
For Windows:

 [2008-11-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 31 20:01:24 2021 UTC