php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60089 DateTime::createFromFormat() U after u nukes microtime
Submitted: 2011-10-18 21:03 UTC Modified: 2016-10-05 20:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: salathe@php.net Assigned: derickr (profile)
Status: Closed Package: Date/time related
PHP Version: trunk-SVN-2011-10-18 (SVN) OS:
Private report: No CVE-ID: None
 [2011-10-18 21:03 UTC] salathe@php.net
Description:
------------
A format string containing a Unix timestamp at any point after a microsecond value 
leaves the microseconds unset in the resulting DateTime object.

Test script:
---------------
<?php

date_default_timezone_set('UTC');

var_dump(DateTime::createFromFormat('u U', '123456 123456790')->format('U u'));

?>

Expected result:
----------------
string(16) "123456790 123456"


Actual result:
--------------
string(16) "123456790 000000"


Patches

trunk-60089-quickfix (last revision 2011-10-18 21:07 UTC by salathe@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-18 21:03 UTC] salathe@php.net
-Assigned To: +Assigned To: derickr
 [2011-10-18 21:07 UTC] salathe@php.net
The following patch has been added/updated:

Patch Name: trunk-60089-quickfix
Revision:   1318972043
URL:        https://bugs.php.net/patch-display.php?bug=60089&patch=trunk-60089-quickfix&revision=1318972043
 [2016-10-05 20:00 UTC] derick@php.net
-Status: Assigned +Status: Closed
 [2016-10-05 20:00 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-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC