php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35218 strtotime no longer ignores timezone comments like (EST)
Submitted: 2005-11-14 18:28 UTC Modified: 2005-11-17 14:09 UTC
From: chagenbu@php.net Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.1.0RC4 OS: Debian 3.1/Kernel 2.6.7
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: chagenbu@php.net
New email:
PHP Version: OS:

 

 [2005-11-14 18:28 UTC] chagenbu@php.net
Description:
------------
A number of mail clients or mail generating scripts generate Date: headers that use the following format:

Sun, 13 Nov 2005 22:56:10 -0800 (PST)

The final part - " (PST)" is not required (and probably technically invalid) by the date format described in RFC 2822, however, it's also probably valid as a header comment. Prior to the 5.1 branch, PHP's strtotime simply ignored comments in this style; however, with 5.1, it causes strtotime to fail and return false. Valid or invalid I think it'd be good for PHP to ignore these and just parse the rest of the date.

Reproduce code:
---------------
<?php

$date = 'Sun, 13 Nov 2005 22:56:10 -0800 (PST)';
$date_fixed = 'Sun, 13 Nov 2005 22:56:10 -0800';

var_dump(strtotime($date));
var_dump(strtotime($date_fixed));


Expected result:
----------------
int(1131951370)
int(1131951370)

Actual result:
--------------
bool(false)
int(1131951370)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-14 19:57 UTC] tony2001@php.net
Assigned to the author of this part.
 [2005-11-17 14:09 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 12:01:33 2024 UTC