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 (profile)
Status: Closed Package: Date/time related
PHP Version: 7.1.0RC3 OS: *
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: derick@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Feb 01 23:01:29 2025 UTC