Bug #75222 [NEW]: DateInterval microseconds property always 0
| From: | chris at cs278 dot org | Date: | Mon, 18 Sep 2017 10:36:50 +0000 |
| Subject: | Bug #75222 [NEW]: DateInterval microseconds property always 0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211205@lists.php.net to get a copy of this message | ||
From: chris at cs278 dot org
Operating system: Linux
PHP version: 7.2.0RC2
Package: Date/time related
Bug Type: Bug
Bug description:DateInterval microseconds property always 0
Description:
------------
If you compute the difference between two DateTimeImmutable objects that
differ only by microseconds the difference is correctly calculated
(visible by var_dump) but the property value is 0.0.
This problem seems to have begun in 7.2.0RC1, betas are not affected.
https://3v4l.org/sM32U
Test script:
---------------
$dt1 = new \DateTimeImmutable('2017-01-01T00:00:00.000000Z');
$dt2 = new \DateTimeImmutable('2017-01-01T00:00:00.123456Z');
$diff = $dt2->diff($dt1);
//var_dump($diff);
var_dump($diff->f);
var_dump(get_object_vars($diff)['f']);
var_dump($diff->f === get_object_vars($diff)['f']);
Expected result:
----------------
float(0.123456)
float(0.123456)
bool(true)
Actual result:
--------------
float(0)
float(0.123456)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=75222&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75222&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75222&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75222&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75222&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75222&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75222&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75222&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75222&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75222&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75222&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75222&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75222&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75222&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75222&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75222&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75222&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75222&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75222&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75222&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75222&r=mysqlcfg