1--TEST-- 2Test for bug #81458: Regression in PHP 8.1: Incorrect difference after timezone change 3--FILE-- 4<?php 5$first = (new DateTime('2018-07-01 00:00:00.000000 America/Toronto'))->setTimezone(new DateTimeZone('UTC')); 6$second = new DateTime('2018-07-02 00:00:00.000000 America/Toronto'); 7 8var_dump($first->diff($second)->days); 9var_dump($first->diff($second)->d); 10 11date_default_timezone_set('UTC'); 12$a = new DateTime('2018-12-01 00:00'); 13$b = new DateTime('2018-12-02 00:01'); 14 15var_dump($a->diff($b)->days); 16?> 17--EXPECT-- 18int(1) 19int(1) 20int(1) 21