php.net |  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
Votes:4
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
Status: No Feedback Package: Date/time related
PHP Version: 5.2.0 OS: Linux
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-02-03 04:27 UTC] kal at kalunite dot net
Description:
------------
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');
if($foo)
{
  echo $foo->format('Y-m-d H:i:s e'),$foo->format('I')?' DST':'';
}
else
{
  echo "FALSE";
}
?>

Expected result:
----------------
FALSE

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-02 12:40 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [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-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 08:02:55 2014 UTC