[php-src] Issue #8860: DatePeriod with 1 hour DateInterval misses hour on long DST day

From: Date: Fri, 24 Jun 2022 10:08:32 +0000
Subject: [php-src] Issue #8860: DatePeriod with 1 hour DateInterval misses hour on long DST day
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241800@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8860 Author: RobertWeideKyos ### Description The following code attempts to loop over hours during the long day that has 1 extra hour because of the daylight saving switch in the location Europe/Amsterdam: ```php <?php $timezone = new DateTimeZone('Europe/Amsterdam'); $interval = new DateInterval('PT1H'); $startDate = new DateTime('2022-10-30 01:00:00', $timezone); $endDate = new DateTime('2022-10-30 04:00:00', $timezone); $period = new DatePeriod($startDate, $interval, $endDate); foreach ($period as $date) { echo $date->format('Y-m-d H:i:s I U') . PHP_EOL; }``` Resulted in this output: ``` | 8.1.6 | 8.1.7 | | --- | --- | | 2022-10-30 01:00:00 1 1667084400<br>2022-10-30 02:00:00 0 1667091600<br>2022-10-30 03:00:00 0 1667095200 | 2022-10-30 01:00:00 1 1667084400<br>2022-10-30 02:00:00 1 1667088000<br>2022-10-30 03:00:00 0 1667095200 | ``` But I expected this output instead: ``` 2022-10-30 01:00:00 1 1667084400<br>2022-10-30 02:00:00 1 1667088000<br>2022-10-30 02:00:00 0 1667091600<br>2022-10-30 03:00:00 0 1667095200 ``` Note that making a similar loop on the short day does indeed leave out the skipped hour. ### PHP Version 8.1.7 ### Operating System _No response_

« previous php.bugs (#241800) next »