Bug #75222 [Asn->Csd]: DateInterval microseconds property always 0

From: Date: Wed, 27 Sep 2017 05:25:09 +0000
Subject: Bug #75222 [Asn->Csd]: DateInterval microseconds property always 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211377@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75222&edit=1 ID: 75222 Updated by: krakjoe@php.net Reported by: chris at cs278 dot org Summary: DateInterval microseconds property always 0 -Status: Assigned +Status: Closed Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.2.0RC2 Assigned To: jhdxr Block user comment: N Private report: N New Comment: Automatic comment on behalf of jhdxr Revision: http://git.php.net/?p=php-src.git;a=commit;h=7deb561f75b74ddf537e8da3efb4498ba5911043 Log: fix bug #75222 DateInterval microseconds property always 0 Previous Comments: ------------------------------------------------------------------------ [2017-09-18 10:36:47] chris at cs278 dot org 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 this bug report at https://bugs.php.net/bug.php?id=75222&edit=1

« previous php.bugs (#211377) next »