php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44909 strtotime doesn't recognize UT timezone
Submitted: 2008-05-04 08:30 UTC Modified: 2008-05-04 08:54 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: selsky at columbia dot edu Assigned:
Status: Wont fix Package: Date/time related
PHP Version: 5.2.6 OS: Solaris
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: selsky at columbia dot edu
New email:
PHP Version: OS:

 

 [2008-05-04 08:30 UTC] selsky at columbia dot edu
Description:
------------
strtotime() does not recognize the timezone "UT".  According to RFC 2822 and the comments in ext/date/php_date.c (line 384), the valid time zones are:

 *  zone        =  "UT"  / "GMT"  /  "EST" / "EDT"  /  "CST" / "CDT"  /  "MST" / "MDT"  /  "PST" / "PDT"  /  1ALPHA  / ( ("+" / "-") 4DIGIT )             

UTC is correctly recognized.

http://bugs.php.net/bug.php?id=42486 was closed as won't fix, but this means we can't parse valid rfc2822 strings.

Reproduce code:
---------------
<?php
print strtotime('12 Sep 2007 15:49:12 UTC') . "\n";
print strtotime('12 Sep 2007 15:49:12 UT') . "\n";


Expected result:
----------------
1189612152
1189612152


Actual result:
--------------
1189612152
[blank]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-04 08:54 UTC] derick@php.net
The comments to go with the line 384 you're mentioned are actually incorrect. RFC2822 in section 3.1, paragraph 3 it is stated that "These "obs-" elements refer to tokens defined in the obsolete syntax in section 4.  In all cases, these productions are to be ignored for the purposes of generating legal Internet messages and MUST NOT be used as part of such a message." As the comment deals with *generating* a date time string as part of a format, it is invalid to mention those obsolete timezones specifications. The nonterminals in the 2822 rfc starting with "obs-" are obsolete parts of the old (RFC 822) standard. We state in the manual (http://no2.php.net/timezones) which time zones we support, and "UT" is not one of those. First of all those timezone names from from a standardized timezone database, and secondly, UT would be semantically wrong as is explained in bug #42486.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC