Bug #78691 [NEW]: DateTime ->modify incorrect behavior in some time zones
| From: | writejohnemail at gmail dot com | Date: | Fri, 18 Oct 2019 15:07:26 +0000 |
| Subject: | Bug #78691 [NEW]: DateTime ->modify incorrect behavior in some time zones | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-223260@lists.php.net to get a copy of this message | ||
From: writejohnemail at gmail dot com
Operating system: Linux
PHP version: 7.4.0RC4
Package: Date/time related
Bug Type: Bug
Bug description:DateTime ->modify incorrect behavior in some time zones
Description:
------------
In time zones that make a daylight savings change at midnight, on the
day of the daylight savings change, ->modify('-1 second') does not work
as expected. America/Santiago, America/Havana, Asia/Tehran,
America/Asuncion are a few of the time zones that have this behavior
Test script:
---------------
$timezone = 'America/Santiago';
$dateString = "2020-09-06";
$dt = new \DateTime($dateString);
$dtz = new \DateTimeZone($timezone);
$dt->setTimezone($dtz);
echo 'the start of the day:<br>';
$dt->modify('today');
echo $dt->getTimestamp();
echo '<br><br>the start of the day, minus one second. this is
incorrect:<br>';
$dt->modify('-1 second');
echo $dt->getTimestamp();
Expected result:
----------------
1599364799
Actual result:
--------------
1599368399
--
Edit bug report at https://bugs.php.net/bug.php?id=78691&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78691&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78691&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78691&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78691&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78691&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78691&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78691&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78691&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78691&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78691&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78691&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78691&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78691&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78691&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78691&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78691&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78691&r=mysqlcfg