Bug #81560 [NEW]: DateTime-Add($interval) endless loop for dst
| From: | mihailovb at gmail dot com | Date: | Thu, 28 Oct 2021 10:37:35 +0000 |
| Subject: | Bug #81560 [NEW]: DateTime-Add($interval) endless loop for dst | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237411@lists.php.net to get a copy of this message | ||
From: mihailovb at gmail dot com
Operating system: CentOS7 (and others)
PHP version: 7.4.25
Package: Date/time related
Bug Type: Bug
Bug description:DateTime-Add($interval) endless loop for dst
Description:
------------
PHP 7.4.25 (CentOS), 7.4.3(Ubuntu20.04), 7.2.34(Ubuntu20.04)
It goes into an endless loop when trying to add a 15M interval only when
working with "negative" timezones. Doesn't happen for European
"pozitive" timezones
Test script:
---------------
<?php
$timezoneDST = new DateTimeZone('America/New_York');
$date = new DateTime("2020-11-01", $timezoneDST);
$dateInterval = new DateInterval('PT15M');
$counter = 0;
while($counter < 500){
$date->add($dateInterval);
$counter++;
}
var_dump($date);
Expected result:
----------------
class DateTime#1 (3) {
public $date =>
string(26) "2020-11-06 04:00:00.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(16) "America/New_York"
}
Actual result:
--------------
class DateTime#2 (3) {
public $date =>
string(26) "2020-11-01 01:00:00.000000"
public $timezone_type =>
int(3)
public $timezone =>
string(16) "America/New_York"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=81560&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81560&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81560&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81560&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81560&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81560&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81560&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81560&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81560&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81560&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81560&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81560&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81560&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81560&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81560&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81560&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81560&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81560&r=mysqlcfg