php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77007 fractions in `diff()` are not correctly normalized
Submitted: 2018-10-12 10:39 UTC Modified: -
From: derick@php.net Assigned:
Status: Closed Package: Date/time related
PHP Version: 7.2.11 OS:
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 + 3 = ?
Subscribe to this entry?

 
 [2018-10-12 10:39 UTC] derick@php.net
Description:
------------
See https://github.com/derickr/timelib/issues/50

Test script:
---------------
<?php
$startDate = new \DateTime('2018-10-11 20:59:06.914653');
$endDate  = new \DateTime('2018-10-11 20:59:07.237419');
$interval = $startDate->diff($endDate);
var_dump($interval->format('%H:%I:%S.%F'));

Expected result:
----------------
string(16) "00:00:00.322766"

Actual result:
--------------
string(16) "00:00:01.-677234"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-12 10:41 UTC] derick@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=94a98f2c63926c5eafe12a717f3eef38f05fe99e
Log: Upgrade timelib to 2017.08, to fix bug #77007
 [2018-10-12 10:41 UTC] derick@php.net
-Status: Open +Status: Closed
 [2018-10-12 10:55 UTC] derick@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9c608bd13f780f822cd12c858f6ea271b9c7a3fb
Log: Upgrade timelib to 2018.01RC1, to fix bug #77007
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 01:01:30 2024 UTC