Bug #81660 [Asn]: DateTimeZone::getTransitions() returns invalid data

From: Date: Fri, 26 Nov 2021 10:00:13 +0000
Subject: Bug #81660 [Asn]: DateTimeZone::getTransitions() returns invalid data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237990@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81660&edit=1

 ID:                 81660
 Updated by:         cmb@php.net
 Reported by:        kenji dot uui at gmail dot com
 Summary:            DateTimeZone::getTransitions() returns invalid data
 Status:             Assigned
 Type:               Bug
 Package:            Date/time related
 Operating System:   macOS
 PHP Version:        8.1.0
 Assigned To:        derick
 Block user comment: N
 Private report:     N

 New Comment:

Confirmed: <https://3v4l.org/MtJ2X>.

<https://www.timeanddate.com/time/zone/usa/chicago>
agrees with
behavior prior to PHP 8.1.0.


Previous Comments:
------------------------------------------------------------------------
[2021-11-26 06:49:50] kenji dot uui at gmail dot com

Description:
------------
DateTimeZone::getTransitions() changed between PHP 8.0.13 and 8.1.0. 


Test script:
---------------
<?php

$tz = new DateTimeZone('America/Chicago');
$start = 1293861600;
$end = 1357020000;
$transitions = $tz->getTransitions($start, $end);
var_dump($transitions);

Expected result:
----------------
array(5) {
  [0]=>
  array(5) {
    ["ts"]=>
    int(1293861600)
    ["time"]=>
    string(24) "2011-01-01T06:00:00+0000"
    ["offset"]=>
    int(-21600)
    ["isdst"]=>
    bool(false)
    ["abbr"]=>
    string(3) "CST"
  }
  [1]=>
  array(5) {
    ["ts"]=>
    int(1300003200)
    ["time"]=>
    string(24) "2011-03-13T08:00:00+0000"
    ["offset"]=>
    int(-18000)
    ["isdst"]=>
    bool(true)
    ["abbr"]=>
    string(3) "CDT"
  }
  [2]=>
  array(5) {
    ["ts"]=>
    int(1320562800)
    ["time"]=>
    string(24) "2011-11-06T07:00:00+0000"
    ["offset"]=>
    int(-21600)
    ["isdst"]=>
    bool(false)
    ["abbr"]=>
    string(3) "CST"
  }
  [3]=>
  array(5) {
    ["ts"]=>
    int(1331452800)
    ["time"]=>
    string(24) "2012-03-11T08:00:00+0000"
    ["offset"]=>
    int(-18000)
    ["isdst"]=>
    bool(true)
    ["abbr"]=>
    string(3) "CDT"
  }
  [4]=>
  array(5) {
    ["ts"]=>
    int(1352012400)
    ["time"]=>
    string(24) "2012-11-04T07:00:00+0000"
    ["offset"]=>
    int(-21600)
    ["isdst"]=>
    bool(false)
    ["abbr"]=>
    string(3) "CST"
  }
}


Actual result:
--------------
array(1) {
  [0]=>
  array(5) {
    ["ts"]=>
    int(1293861600)
    ["time"]=>
    string(24) "2011-01-01T06:00:00+0000"
    ["offset"]=>
    int(-18000)
    ["isdst"]=>
    bool(true)
    ["abbr"]=>
    string(3) "CDT"
  }
}


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81660&edit=1


Thread (5 messages)

« previous php.bugs (#237990) next »