Bug #80896 [NEW]: Daylight time mishandled for America/Havana and Asia/Tehran timezones

From: Date: Mon, 22 Mar 2021 19:01:19 +0000
Subject: Bug #80896 [NEW]: Daylight time mishandled for America/Havana and Asia/Tehran timezones
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232920@lists.php.net to get a copy of this message
From:             ctiancheng at fb dot com
Operating system: 
PHP version:      8.0Git-2021-03-22 (Git)
Package:          *General Issues
Bug Type:         Bug
Bug description:Daylight time mishandled for America/Havana and Asia/Tehran timezones

Description:
------------
---
From manual page: https://php.net/timezones.america
---
America/Havana and Asia/Tehran are two supported timezones listed from
the documentation. However, The DateTime are not handled correctly
during daylight time transition.
This happens when doing $dt->add(new DateInterval('P1D'));

On e.g. 2021/03/14 for America/Havana
On e.g. 2021/03/21 for Asia/Tehran


Test script:
---------------
//
http://sandbox.onlinephpfunctions.com/code/0650352a9684872c8dcfff00a64b11660a56eba8
$local_timezone_name = 'America/Havana';
$timestamp = 1615611600; // local time 3/13/21 0:00
$time = (new DateTime())->setTimestamp($timestamp)
      ->setTimezone(new DateTimeZone($local_timezone_name));
$time->add(new DateInterval('P1D')); // local time 03/13/21 1:00

//
http://sandbox.onlinephpfunctions.com/code/623d5587f5453dd487492e5fde64cc836a84dcd9
$local_timezone_name = 'Asia/Tehran';
$timestamp = 1616272200; // local time 3/21/21 0:00
$time = (new DateTime())->setTimestamp($timestamp)
      ->setTimezone(new DateTimeZone($local_timezone_name));
$time->add(new DateInterval('P1D')); // local time 03/22/21 1:00



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


Thread (6 messages)

« previous php.bugs (#232920) next »