[php-src] Issue #10163: DateTime->diff() error

From: Date: Fri, 23 Dec 2022 17:39:36 +0000
Subject: [php-src] Issue #10163: DateTime->diff() error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243236@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10163 Author: AleWhey ### Description Code: <?php $timezone = new DateTimeZone('Europe/Kaliningrad'); $timezone2 = new DateTimeZone('UTC'); $datetime = new DateTime("2022-12-23 16:45", $timezone2); $res = new DateTime('2022-12-25 18:00', $timezone); $diff = $datetime->diff($res); print_r($diff); Result (look at y / m / d): DateInterval Object ( [y] => -1 [m] => 11 [d] => 29 [h] => 0 [i] => 45 [s] => 23 [f] => 0.792402 [invert] => 1 [days] => 1 [from_string] => ) But must be (on 8.18 and lower version): DateInterval Object ( [y] => 0 [m] => 0 [d] => 1 [h] => 23 [i] => 15 [s] => 0 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 1 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) ### PHP Version 8.1.9+ ### Operating System Debian

« previous php.bugs (#243236) next »