[php-src] Issue #21616: DateTime::modify('-1 second') goes 59 minutes later on DST

From: Date: Fri, 03 Apr 2026 08:46:19 +0000
Subject: [php-src] Issue #21616: DateTime::modify('-1 second') goes 59 minutes later on DST
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251894@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21616 Author: kylekatarnls ### Description The following code: ```php <?php echo (new DateTime('2025-03-30 00:59:59', new DateTimeZone('Europe/London'))) ->modify('+1 second') ->modify('-1 second') ->format('Y-m-d H:i:s.u e T'); ``` Resulted in this output: ``` 2025-03-30 02:59:59.000000 Europe/London BST ``` But I expected this output instead: ``` 2025-03-30 00:59:59.000000 Europe/London GMT ``` Which is also the output we get when executing (since PHP 8.1, before that add/sub interval and modify gave the same output): ```php echo (new DateTime('2025-03-30 00:59:59', new DateTimeZone('Europe/London'))) ->add(new DateInterval('PT1S')) ->sub(new DateInterval('PT1S')) ->format('Y-m-d H:i:s.u e T'); ``` ### PHP Version ```plain PHP 8.5.3 ``` ### Operating System _No response_

« previous php.bugs (#251894) next »