Bug #81560 [Opn->Ver]: DateTime-Add($interval) endless loop for dst

From: Date: Thu, 28 Oct 2021 11:23:30 +0000
Subject: Bug #81560 [Opn->Ver]: DateTime-Add($interval) endless loop for dst
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237412@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81560&edit=1 ID: 81560 Updated by: cmb@php.net Reported by: mihailovb at gmail dot com Summary: DateTime-Add($interval) endless loop for dst -Status: Open +Status: Verified Type: Bug Package: Date/time related Operating System: CentOS7 (and others) PHP Version: 7.4.25 -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: This is apparently fixed as of PHP 8.1.0[1]; I'm not sure whether the fix will be backported. [1] <https://3v4l.org/1df2R> Previous Comments: ------------------------------------------------------------------------ [2021-10-28 10:37:34] mihailovb at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=81560&edit=1

« previous php.bugs (#237412) next »