Bug #81263 [Asn]: Wrong result from DateTimeImmutable::diff

From: Date: Thu, 21 Oct 2021 13:23:19 +0000
Subject: Bug #81263 [Asn]: Wrong result from DateTimeImmutable::diff
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237321@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81263&edit=1 ID: 81263 Updated by: cmb@php.net Reported by: mail at gh01 dot de Summary: Wrong result from DateTimeImmutable::diff Status: Assigned Type: Bug Package: Date/time related PHP Version: master-Git-2021-07-15 (Git) Assigned To: derick Block user comment: N Private report: N New Comment: This appears to be related to bug #81458. Previous Comments: ------------------------------------------------------------------------ [2021-10-21 13:16:03] sjon@php.net while the related https://3v4l.org/8g4NB seems fixed, this issue remains ------------------------------------------------------------------------ [2021-10-07 22:36:34] mail at gh01 dot de This issue still exists in current master: https://3v4l.org/f1fai/rfc#vgitmaster ------------------------------------------------------------------------ [2021-08-08 11:18:24] derick@php.net Duplicate of #81273 ------------------------------------------------------------------------ [2021-07-15 21:32:41] mail at gh01 dot de Description: ------------ PHP 8.0 (correct): https://3v4l.org/Wofuu#v8.0.8 PHP 8.1 (wrong): https://3v4l.org/Wofuu/rfc#vgit.master Test script: --------------- <?php $dt1 = new DateTimeImmutable('2020-07-19 18:30:00', new DateTimeZone('Europe/Berlin')); $dt2 = new DateTimeImmutable('2020-07-19 16:30:00', new DateTimeZone('UTC')); print_r($dt1->diff($dt2)); Expected result: ---------------- DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) Actual result: -------------- DateInterval Object ( [y] => -1 [m] => 11 [d] => 29 [h] => 24 [i] => 0 [s] => 0 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81263&edit=1

« previous php.bugs (#237321) next »