php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73247 DateTime constructor does not initialise microseconds property
Submitted: 2016-10-04 21:02 UTC Modified: 2016-10-05 20:09 UTC
From: derick@php.net Assigned: derick
Status: Closed Package: Date/time related
PHP Version: 7.1.0RC3 OS: *
Private report: No CVE-ID:
 [2016-10-04 21:02 UTC] derick@php.net
Description:
------------
When initialising the DateTime constructor without specifying the time, the microseconds property isn't initialised.

Test script:
---------------
<?php
$a = new DateTimeImmutable;
var_dump($a);
?>

Expected result:
----------------
class DateTimeImmutable#1 (3) {
  public $date =>
  string(26) "2016-09-19 11:20:18.723145"
  public $timezone_type =>
  int(3)
  public $timezone =>
  string(13) "Europe/London"
}

Actual result:
--------------
class DateTimeImmutable#1 (3) {
  public $date =>
  string(26) "2016-09-19 11:20:18.000000"
  public $timezone_type =>
  int(3)
  public $timezone =>
  string(13) "Europe/London"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-05 20:09 UTC] derick@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: derick
 [2016-10-05 20:09 UTC] derick@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed for PHP 7.1.0 RC4.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Apr 30 22:01:36 2017 UTC