[php-src] Issue #10822: Different diff->days between php 8.0.28 and php 8.1

From: Date: Fri, 10 Mar 2023 08:53:38 +0000
Subject: [php-src] Issue #10822: Different diff->days between php 8.0.28 and php 8.1
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243885@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10822 Author: szpakucjusz ### Description Good morning, Link with different php versions comparison: https://3v4l.org/mgOoE#v8.1.0 The following code returns the difference for DateInterval->days: ```php <?php $d = new DateTime('-1 day'); $diff = $d->diff(new DateTime('-6 days') ); echo "\n"; print_r($diff); echo $diff->days; echo "\n"; ``` Resulted in this output for php 8.0.28: ``` DateInterval Object ( [y] => 0 [m] => 0 [d] => 4 [h] => 23 [i] => 59 [s] => 59 [f] => 0.999994 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 1 [days] => 5 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) ``` But In PHP 8.1.0: ``` DateInterval Object ( [y] => 0 [m] => 0 [d] => 4 [h] => 23 [i] => 59 [s] => 59 [f] => 0.99999 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 1 [days] => 4 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) ``` ### PHP Version Change between PHP 8.0.28 and 8.1 ### Operating System _No response_

« previous php.bugs (#243885) next »