php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76125 error date_create_from_format
Submitted: 2018-03-21 12:21 UTC Modified: 2018-03-21 13:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: denorian at yandex dot ru Assigned:
Status: Open Package: Date/time related
PHP Version: 7.0.28 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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: denorian at yandex dot ru
New email:
PHP Version: OS:

 

 [2018-03-21 12:21 UTC] denorian at yandex dot ru
Description:
------------
Error in reading the date in the function date_create_from_format

Test script:
---------------
<?
$date = date_create_from_format("D, d M Y H:i:s O", "Tue, 20 Mar 2018 01:38:22 GMT");
echo date_format($date, 'Y-m-d');

//result 2018-03-20

$date = date_create_from_format("D, d M Y H:i:s O", "Tue, 21 Mar 2018 01:38:22 GMT");
echo date_format($date, 'Y-m-d');

//result 2018-03-27  27? Why?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-21 13:00 UTC] cmb@php.net
-Package: date_time +Package: Date/time related
 [2018-03-21 13:00 UTC] cmb@php.net
> //result 2018-03-27  27? Why?

Since there is no Tue, 21 Mar 2018, the parser apparently assumes
you've meant Tue, 27 Mar 2018 01:38:22 GMT.
 [2018-03-21 13:58 UTC] spam2 at rhsoft dot net
the parser should throw a warning

[builduser@testserver:/rpmbuild/SPECS]$ rpmlint fsync-tester.spec
fsync-tester.spec: E: specfile-error warning: bogus date in %changelog: Wed Feb 22 2018

because Wed is wrong, it was a tuesday
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Oct 19 15:01:26 2018 UTC