Bug #81287 [Opn]: TimeZone::getTransitions Not Working
Edit report at https://bugs.php.net/bug.php?id=81287&edit=1
ID: 81287
Updated by: ramsey@php.net
Reported by: eclipsechasers2 at yahoo dot com
Summary: TimeZone::getTransitions Not Working
Status: Open
Type: Bug
Package: Date/time related
Operating System: Windows 10
PHP Version: 8.1.0beta1
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Assigning to Derick. Possible duplicate of #80963.
Previous Comments:
------------------------------------------------------------------------
[2021-07-26 00:10:34] antonino dot spampinato86 at gmail dot com
Since php 8.1 getTransitions returns the break period not all occurrences of transitions.
https://bugs.php.net/bug.php?id=80963
https://3v4l.org/0ZeER#vgit.master_jit
------------------------------------------------------------------------
[2021-07-25 05:10:40] eclipsechasers2 at yahoo dot com
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"
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81287&edit=1
Thread (4 messages)