Bug #76822 [NEW]: DateTime mircoseconds rounding issue
From: jamesin dot hongkong dot 1 at gmail dot com
Operating system: any
PHP version: 7.2.9
Package: Date/time related
Bug Type: Bug
Bug description:DateTime mircoseconds rounding issue
Description:
------------
Some of our integration tests suddenly fail on PHP7.2+ due to a rounding
issue in regards to DateTime/microseconds.
## Reproducible example
```
Output for hhvm-3.18.5 - 3.22.0, 7.2.0 - 7.3.0beta2
2011-01-01 15:03:01.888499
Output for 5.6.30, 7.0.28 - 7.1.21
2011-01-01 15:03:01.888500
```
https://3v4l.org/al15I
Test script:
---------------
$d = new DateTime('2011-01-01T15:03:01.88849994Z');
print $d->format( 'Y-m-d H:i:s.u' );
Expected result:
----------------
2011-01-01 15:03:01.888500
Actual result:
--------------
2011-01-01 15:03:01.888499
--
Edit bug report at https://bugs.php.net/bug.php?id=76822&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76822&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76822&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76822&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76822&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76822&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76822&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76822&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76822&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76822&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76822&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76822&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76822&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76822&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76822&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76822&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76822&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76822&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76822&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76822&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76822&r=mysqlcfg
Thread (3 messages)
- jamesin dot hongkong dot 1 at gmail dot com