|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71649 DateTime createFromFormat ATOM_DATE accepting short year value
Submitted: 2016-02-23 11:34 UTC Modified: -
From: chehax at gmail dot com Assigned:
Status: Open Package: *Programming Data Structures
PHP Version: 5.6.18 OS: OSX 10.11.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
44 - 4 = ?
Subscribe to this entry?

 [2016-02-23 11:34 UTC] chehax at gmail dot com
From manual page:

It appears that creating a datetime object via createFromFormat and using DATEATOM support short year format, like 20-01-01T15:15:15Z.

This isn't matching format which is Y-m-d\TH:i:sO and should return false.

Doc for Y string format : 
+ A full numeric representation of a year, 4 digits

Test script:
$d = DateTime::createFromFormat(DATE_ATOM, "20-01-01T01:01:01Z");
var_dump($d); // should return false


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 23 14:01:24 2021 UTC