Bug #80998 [NEW]: Missing second with inverted interval
| From: | kylekatarnls at gmail dot com | Date: | Wed, 28 Apr 2021 09:07:48 +0000 |
| Subject: | Bug #80998 [NEW]: Missing second with inverted interval | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-233603@lists.php.net to get a copy of this message | ||
From: kylekatarnls at gmail dot com
Operating system: Ubuntu
PHP version: master-Git-2021-04-28 (Git)
Package: Date/time related
Bug Type: Bug
Bug description:Missing second with inverted interval
Description:
------------
When adding an inverted interval containing microseconds, 1 second miss
in the final result (with PHP >= 8.1 but not < 8.1)
See https://github.com/kylekatarnls/datetime-bug/runs/2456014545
Test script:
---------------
$date = new DateTime('2021-04-05 14:00:00');
$interval = new DateInterval('P0DT10799S');
$interval->f = 0.999999;
$interval->invert = 1;
$date->add($interval);
$string = $date->format('Y-m-d H:i:s.u');
echo $string;
Expected result:
----------------
2021-04-05 11:00:00.000001
Actual result:
--------------
2021-04-05 11:00:01.000001
--
Edit bug report at https://bugs.php.net/bug.php?id=80998&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80998&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80998&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80998&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80998&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80998&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80998&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80998&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80998&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80998&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80998&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80998&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80998&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80998&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80998&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80998&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80998&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80998&r=mysqlcfg