|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-07-26 00:10 UTC] antonino dot spampinato86 at gmail dot com
[2021-08-03 12:39 UTC] ramsey@php.net
-Assigned To:
+Assigned To: derick
[2021-08-03 12:39 UTC] ramsey@php.net
[2021-08-08 11:14 UTC] derick@php.net
-Status: Assigned
+Status: Duplicate
[2021-08-08 11:14 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
Description: ------------ In PHP8.0 and PHP7.*, the code below produces an array of 5 items, with offset toggling back and forth between -14400 and -18000, and with abbr toggling between EDT and EST. In PHP8.1, it produces an array of 1 item, with an (incorrect) offset of -14400 and (incorrect) abbr of EDT. The timestamps match between 8.1 and other releases, so the problem must be in getTransitions. I chose 8.1Beta1 as best match; in fact, my version is: PHP 8.1.0-dev (cli) (built: Jul 24 2021 23:42:29) (NTS Visual C++ 2019 x64) Test script: --------------- $timeZone = new DateTimeZone('America/Toronto'); $timestamp = '2008-01-01 12:00:00'; $dtobj = DateTime::createFromFormat('Y-m-d H:i:s', $timestamp); $tstmp = $dtobj->getTimestamp(); $timestam2 = '2010-01-01 12:00:00'; $dtob2 = DateTime::createFromFormat('Y-m-d H:i:s', $timestam2); $tstm2 = $dtob2->getTimestamp(); var_dump($tstmp, $tstm2); $transitions = $timeZone->getTransitions($tstmp, $tstm2); var_dump($transitions); Expected result: ---------------- I expect the same result as in other releases - 5 items in array, toggling between EDT and EST, and between an offset of -18000 and -14400. int(1199217600) int(1262376000) array(5) { [0]=> array(5) { ["ts"]=> int(1199217600) ["time"]=> string(24) "2008-01-01T20:00:00+0000" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } [1]=> array(5) { ["ts"]=> int(1205046000) ["time"]=> string(24) "2008-03-09T07:00:00+0000" ["offset"]=> int(-14400) ["isdst"]=> bool(true) ["abbr"]=> string(3) "EDT" } [2]=> array(5) { ["ts"]=> int(1225605600) ["time"]=> string(24) "2008-11-02T06:00:00+0000" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } [3]=> array(5) { ["ts"]=> int(1236495600) ["time"]=> string(24) "2009-03-08T07:00:00+0000" ["offset"]=> int(-14400) ["isdst"]=> bool(true) ["abbr"]=> string(3) "EDT" } [4]=> array(5) { ["ts"]=> int(1257055200) ["time"]=> string(24) "2009-11-01T06:00:00+0000" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } } Actual result: -------------- int(1199188800) int(1262347200) array(1) { [0]=> array(5) { ["ts"]=> int(1199188800) ["time"]=> string(24) "2008-01-01T12:00:00+0000" ["offset"]=> int(-14400) ["isdst"]=> bool(true) ["abbr"]=> string(3) "EDT" } }