Bug #76218 [Opn->Nab]: Format DATE_RFC3339_EXTENDED fails to match valid input
| From: | requinix@php.net | Date: | Fri, 13 Apr 2018 14:12:12 +0000 |
| Subject: | Bug #76218 [Opn->Nab]: Format DATE_RFC3339_EXTENDED fails to match valid input | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214731@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76218&edit=1
ID: 76218
Updated by: requinix@php.net
Reported by: giacomo dot pinato at gmail dot com
Summary: Format DATE_RFC3339_EXTENDED fails to match valid
input
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: MacOS
PHP Version: 7.2.4
Block user comment: N
Private report: N
New Comment:
The format string is "Y-m-d\TH:i:s.vP". I do not see 'v' listed as supported in
the docs for createFromFormat.
Use DateTime::getLastErrors() to see the warnings.
What example did you see with that code?
Previous Comments:
------------------------------------------------------------------------
[2018-04-13 14:02:33] giacomo dot pinato at gmail dot com
Description:
------------
The DateTime class fails to correctly instantiate with the DATE_RFC3339_EXTENDED when input data is
correct.
The example in this bug is taken directly from the documentation at http://php.net/manual/en/class.datetime.php
Test script:
---------------
<?php
$willBeFalse = DateTime::createFromFormat(DATE_RFC3339_EXTENDED,
'2005-08-15T15:52:01.000+00:00');
$willAlsoBeFalse = DateTimeImmutable::createFromFormat(DATE_RFC3339_EXTENDED,
'2005-08-15T15:52:01.000+00:00');
$date = new DateTime();
$shouldNotBeFalse = DateTime::createFromFormat(DATE_RFC3339_EXTENDED,
$date->format(DATE_RFC3339_EXTENDED));
var_dump($shouldNotBeFalse); // false
Expected result:
----------------
The two objects should get instantiated correctly
Actual result:
--------------
$willBeFalse and $willAlsoBeFalse are false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76218&edit=1