php.net |  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
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: chehax at gmail dot com
New email:
PHP Version: OS:

 

 [2016-02-23 11:34 UTC] chehax at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/class.datetime
---

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:
---------------
<?php
$d = DateTime::createFromFormat(DATE_ATOM, "20-01-01T01:01:01Z");
var_dump($d); // should return false


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2023-05-05 06:08 UTC] vishalbhawan65 at gmail dot com
Technology web inc are sharing latest news about tech, web development, seo, smo, mobile apps, digital marketing etc. More info to visit: (https://technologywebinc.com)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 18:01:31 2024 UTC