|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #76009 Cant parse v
Submitted: 2018-02-26 01:18 UTC Modified: 2018-02-26 07:25 UTC
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (25.0%)
From: rparker at kodama dot design Assigned:
Status: Open Package: Date/time related
PHP Version: 7.1.14 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-02-26 01:18 UTC] rparker at kodama dot design
`\DateTime::createFromFormat('Y-m-d\TH:i:sP', '2015-06-09T14:00:00-07:00')` works but `\DateTime::createFromFormat('Y-m-d\TH:i:s.vP', '2015-06-09T14:00:00.000-07:00')` doesnt.

`var_dump(\DateTime::getLastErrors())` outputs `array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(2) ["errors"]=> array(2) { [26]=> string(35) "The format separator does not match" [27]=> string(13) "Trailing data" } }`

It is being triggered by the `v` option which should be supported.

Test script:
\DateTime::createFromFormat('Y-m-d\TH:i:s.vP', '2015-06-09T14:00:00.000-07:00');


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-26 01:57 UTC]
-Type: Bug +Type: Feature/Change Request
 [2018-02-26 07:25 UTC]
Looks like this got missed out when we added 'v' to formatting. However, this has recently been added to timelib (the library behind the functionality). Parsing 'v' should make it into PHP 7.3.
 [2018-06-18 20:52 UTC] auroraeosrose at gmail dot com
This should be changed into a Documentation bug if v is not present in 7.2 - docs say it was added in PHP 7.0.0 currently
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 18:01:26 2019 UTC