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

From: Date: Fri, 26 Nov 2021 06:49:50 +0000
Subject: Bug #81660 [NEW]: DateTimeZone::getTransitions() returns invalid data
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237987@lists.php.net to get a copy of this message
From:             kenji dot uui at gmail dot com
Operating system: macOS
PHP version:      8.1.0
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTimeZone::getTransitions() returns invalid data

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 bug report at https://bugs.php.net/bug.php?id=81660&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81660&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81660&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81660&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81660&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81660&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81660&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81660&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81660&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81660&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81660&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81660&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81660&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81660&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81660&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81660&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81660&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81660&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#237987) next »