Bug #74258 [Com]: Microseconds are missing in DateTime class
| From: | sjon at hortensius dot net | Date: | Tue, 21 Mar 2017 16:16:50 +0000 |
| Subject: | Bug #74258 [Com]: Microseconds are missing in DateTime class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207985@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74258&edit=1
ID: 74258
Comment by: sjon at hortensius dot net
Reported by: dawid dot lakomski at gmail dot com
Summary: Microseconds are missing in DateTime class
Status: Open
Type: Bug
Package: Date/time related
Operating System: Ubuntu 16.04
PHP Version: 7.1.3
Block user comment: N
Private report: N
New Comment:
Thanks for reporting, this will be fixed in 7.1.4
Fixed in https://github.com/php/php-src/commit/2b7c3831cdc9a0e708040af37d8cf8967755bce3
Previous Comments:
------------------------------------------------------------------------
[2017-03-21 16:04:05] fox91fox at gmail dot com
I have the same issue inside official Docker image.
Test script:
------------
<?php
echo (new DateTimeImmutable('now'))->format('H:i:s.u');
Results:
--------
PHP 7.0.17: 15:53:06.000000
PHP 7.1.0: 15:53:26.871760
PHP 7.1.1: 15:53:38.272202
PHP 7.1.2: 15:53:48.824298
PHP 7.1.3: 15:54:03.000000
I've tested multiple times every version.
------------------------------------------------------------------------
[2017-03-18 06:40:10] malte dot blaettermann at gmail dot com
Maybe this commit has introduced the bug?
https://github.com/php/php-src/commit/5113909259f897c9c69f23cf5f8f7ab8972d5eba
------------------------------------------------------------------------
[2017-03-17 07:35:44] dawid dot lakomski at gmail dot com
Description:
------------
After upgrading to PHP 7.1.3 I noticed that microseconds are now missing from DateTime objects.
Test script:
---------------
<?php
var_dump(new \DateTime());
Expected result:
----------------
Microseconds part of $date field should not be 000000 (or not always ;) )
Actual result:
--------------
class DateTime#1 (3) {
public $date =>
string(26) "2017-03-17 08:25:48.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(13) "Europe/Berlin"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74258&edit=1