Bug #73138 [Opn->Asn]: strtotime miscalculates when exiting DST with relative time
| From: | bwoebi@php.net | Date: | Wed, 21 Sep 2016 20:35:14 +0000 |
| Subject: | Bug #73138 [Opn->Asn]: strtotime miscalculates when exiting DST with relative time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-204168@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73138&edit=1
ID: 73138
Updated by: bwoebi@php.net
Reported by: z dot himdi at bita dot nl
Summary: strtotime miscalculates when exiting DST with
relative time
-Status: Open
+Status: Assigned
Type: Bug
-Package: *General Issues
+Package: Date/time related
Operating System: Windows 10
PHP Version: 5.6.26
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Related to bug #30532
This bug had been marked as fixed while not being fixed at all; the test
(ext/date/tests/bug30532.phpt) is using the *actual* result instead of the *expected* result in the
--EXPECT-- section, for some reason?
Most crucially:
echo date('r', strtotime('+ 0 second', 1477789199));
outputs:
Sun, 30 Oct 2016 02:59:59 +0100
which is ... exactly one hour later, while we, in fact, did not change anything to the time. (I very
much hope "+ 0 second" is supposed to be a no-op!)
Previous Comments:
------------------------------------------------------------------------
[2016-09-21 17:28:35] z dot himdi at bita dot nl
Description:
------------
strtotime does not calculate correctly when adding or subtracting time relatively while exiting DST.
Test script:
---------------
date_default_timezone_set("Europe/Amsterdam");
echo strtotime('+ 1 second', 1477789199);
// exiting DST in October, echoes 1477792800 in stead of 1477789200
echo strtotime('+ 1 second - 1 second', 1477789199);
// exiting and re-entering DST, echoes 1477792799 in stead of 1477789199
echo strtotime('- 1 second', 1459040400);
// exiting DST in March, echoes 1459043999 in stead of 1459040399
Expected result:
----------------
see the comments in the test script
Actual result:
--------------
one hour of unwanted difference
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73138&edit=1