[php-src] Issue #11269: Different $dateInterval->m between PHP 8.0.28 and PHP 8.1.0

From: Date: Thu, 18 May 2023 18:32:43 +0000
Subject: [php-src] Issue #11269: Different $dateInterval->m between PHP 8.0.28 and PHP 8.1.0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244480@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11269 Author: joelpittet ### Description The following code: Ran into this while trying to debug a different problem with our date calculations. The number of months is different and there is no mention of this change in the changelogs. I'm not claiming I know the correct result, just reporting the difference. https://3v4l.org/6dfda ```php <?php $start_date = (new DateTime('2023-05-01')); $end_date = (new DateTime('2023-07-15'))->modify('last day of this month'); $interval = $start_date->diff($end_date); $months = $interval->format('%m'); $months_property = $interval->m; echo "months format: $months"; echo "\nmonths_property: $months_property"; ``` Resulted in this output: ``` Output for 8.1.0 - 8.1.19, 8.2.0 - 8.2.6 months format: 2 months_property: 2 Output for 8.0.1 - 8.0.28 months format: 3 months_property: 3 ``` But I expected this output instead: ``` The same (either 3 or 2) or a note on the documentation as to why the difference. ``` ### PHP Version PHP 8.0.28 ### Operating System _No response_

« previous php.bugs (#244480) next »