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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 00:01:36 2025 UTC