Bug #72255 [Opn->Dup]: DST-handling in DatePeriod on transition back is buggy

From: Date: Sun, 19 Mar 2017 11:58:56 +0000
Subject: Bug #72255 [Opn->Dup]: DST-handling in DatePeriod on transition back is buggy
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207954@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72255&edit=1 ID: 72255 Updated by: heiglandreas@php.net Reported by: heiglandreas@php.net Summary: DST-handling in DatePeriod on transition back is buggy -Status: Open +Status: Duplicate Type: Bug Package: Date/time related Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: We're now tracking this in https://bugs.php.net/bug.php?id=74274 Previous Comments: ------------------------------------------------------------------------ [2016-05-23 05:51:50] heiglandreas@php.net Description: ------------ Handling the transition back from DST to default time is buggy in DatePeriod. The extra hour is not showing when iterating over a DatePeriod covering the transition back from DST to default time. See https://gist.github.com/heiglandreas/7b7fc82471f4619f66f329a31b566112 and https://3v4l.org/2aDp3 for code-examples. Test script: --------------- <?php $interval = new DateInterval('PT1H'); // DST change in Europe is on the 30. October 2016 $dateTimeStart = new DateTimeImmutable('2016-10-30 01:30:00', new DateTimezone('Europe/Berlin')); $dateTimeEnd = new DateTimeImmutable('2016-10-30 03:31:00', new DateTimezone('Europe/Berlin')); $period = new DatePeriod($dateTimeStart, $interval, $dateTimeEnd); foreach ($period as $date) { echo $date->format('c') . "\n"; } Expected result: ---------------- 2016-10-30T01:30:00+02:00 2016-10-30T02:30:00+02:00 2016-10-30T02:30:00+01:00 2016-10-30T03:30:00+01:00 Actual result: -------------- 2016-10-30T01:30:00+02:00 2016-10-30T02:30:00+01:00 2016-10-30T03:30:00+01:00 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72255&edit=1

« previous php.bugs (#207954) next »