Bug #73138 [NEW]: strtotime miscalculates when exiting DST with relative time
| From: | z dot himdi at bita dot nl | Date: | Wed, 21 Sep 2016 17:28:39 +0000 |
| Subject: | Bug #73138 [NEW]: strtotime miscalculates when exiting DST with relative time | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204165@lists.php.net to get a copy of this message | ||
From: z dot himdi at bita dot nl
Operating system: Windows 10
PHP version: 5.6.26
Package: *General Issues
Bug Type: Bug
Bug description:strtotime miscalculates when exiting DST with relative time
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 bug report at https://bugs.php.net/bug.php?id=73138&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73138&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73138&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73138&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73138&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73138&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73138&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73138&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73138&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73138&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73138&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73138&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73138&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73138&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73138&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73138&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73138&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73138&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73138&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73138&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73138&r=mysqlcfg