[php-src] Issue #9382: DateTime::diff doesnt evaluate daylight saving time correctly

From: Date: Fri, 19 Aug 2022 16:00:54 +0000
Subject: [php-src] Issue #9382: DateTime::diff doesnt evaluate daylight saving time correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242262@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9382 Author: chaosben ### Description The following code: ```php <?php $dt1 = new DateTime('2022-08-01 07:00:00', new DateTimeZone('Europe/Berlin')); $dt2 = new DateTime('2022-08-01 07:00:00 +02:00'); echo "DT1: {$dt1->format('c')}" . PHP_EOL; echo "DT2: {$dt2->format('c')}" . PHP_EOL; $diff = $dt1->diff($dt2); echo "Diff: {$diff->format('%h')}"; ``` Resulted in this output: ``` DT1: 2022-08-01T07:00:00+02:00 DT2: 2022-08-01T07:00:00+02:00 Diff: 1 ``` But I expected this output instead: ``` DT1: 2022-08-01T07:00:00+02:00 DT2: 2022-08-01T07:00:00+02:00 Diff: 0 ``` According to https://3v4l.org/eOUP5 this bug exists since PHP 8.1.0 ### PHP Version PHP 8.1.9 ### Operating System Fedora 36

« previous php.bugs (#242262) next »