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

From: Date: Mon, 25 Sep 2017 19:00:44 +0000
Subject: Bug #75222 [Opn->Asn]: DateInterval microseconds property always 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211353@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: jhdxr@php.net Reported by: chris at cs278 dot org Summary: DateInterval microseconds property always 0 -Status: Open +Status: Assigned Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.2.0RC2 -Assigned To: +Assigned To: jhdxr Block user comment: N Private report: N 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 (#211353) next »