Bug #72255 [NEW]: DST-handling in DatePeriod on transition back is buggy
| From: | heiglandreas@php.net | Date: | Mon, 23 May 2016 05:51:55 +0000 |
| Subject: | Bug #72255 [NEW]: DST-handling in DatePeriod on transition back is buggy | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201231@lists.php.net to get a copy of this message | ||
From: heiglandreas
Operating system: Irrelevant
PHP version: Irrelevant
Package: Date/time related
Bug Type: Bug
Bug description:DST-handling in DatePeriod on transition back is buggy
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 bug report at https://bugs.php.net/bug.php?id=72255&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72255&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72255&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72255&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72255&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72255&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72255&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72255&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72255&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72255&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72255&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72255&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72255&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72255&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72255&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72255&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72255&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72255&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72255&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72255&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72255&r=mysqlcfg