Bug #77145 [Com]: Inconsistent handle of negative interval lower than 1 second

From: Date: Tue, 13 Nov 2018 14:15:59 +0000
Subject: Bug #77145 [Com]: Inconsistent handle of negative interval lower than 1 second
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217933@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77145&edit=1

 ID:                 77145
 Comment by:         kylekatarnls at gmail dot com
 Reported by:        kylekatarnls at gmail dot com
 Summary:            Inconsistent handle of negative interval lower than
                     1 second
 Status:             Duplicate
 Type:               Bug
 Package:            Date/time related
 PHP Version:        7.3.0RC5
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Yes it may be the same.

I would add, if we pass $absolute = TRUE, we still get the negative result.


Previous Comments:
------------------------------------------------------------------------
[2018-11-13 13:42:16] cmb@php.net

This looks like a duplicate of bug #77097.

------------------------------------------------------------------------
[2018-11-13 12:46:20] kylekatarnls at gmail dot com

Description:
------------
When calling DateTime::diff from (DateX) to (DateX - few microseconds), I get inconsistent intervals
between versions and none are what I would expect (inverted interval with positive microseconds).

Test script:
---------------
$s = new DateTime('2018-10-11 20:59:06.914653');
$e = new DateTime('2018-10-11 20:59:06.237419');

echo $s->diff($e)->format('%R %Y-%M-%D %H:%I:%S.%F');

Expected result:
----------------
- 00-00-00 00:00:00.677234

Actual result:
--------------
Output for 7.3.0rc4 - 7.3.0rc5

+ -1-11-29 23:59:59.322766

Output for 7.1.0 - 7.3.0rc3

+ 00-00-00 00:00:00.-677234

As tested with https://3v4l.org/hnnL0

Note sure, but I guess 7.2.12 would looks like 7.3.0rc5 as it's probably consecutive to https://bugs.php.net/bug.php?id=77007 bugfix


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77145&edit=1


Thread (4 messages)

« previous php.bugs (#217933) next »