Bug #76983 [NEW]: date('i') returns wrong value for Dublin timezone
| From: | tomas at matrixinternet dot ie | Date: | Mon, 08 Oct 2018 06:38:55 +0000 |
| Subject: | Bug #76983 [NEW]: date('i') returns wrong value for Dublin timezone | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217464@lists.php.net to get a copy of this message | ||
From: tomas at matrixinternet dot ie
Operating system: Ubuntu 16.04
PHP version: 5.6.38
Package: Date/time related
Bug Type: Bug
Bug description:date('i') returns wrong value for Dublin timezone
Description:
------------
We use date('I') (capital i) to detect daylight saving time being in
action or not. It kept returning "1" quite happily throughout the
summer. On 29/09/2018 around 7:00 am, it started returning "0",
indicating a change to a winter time. This happened pretty much exactly
one full month before the change was about to happen on October 29.
Linux Timezone is: Europe/Dublin (IST, +0100) PHP timezone is set via
date_default_timezone_set('Europe/Dublin');
date('I', strtotime('2018-09-29 02:00:00')) // returns "0" - which is
wrong as DST is active now!
date('I', strtotime('2018-11-29 02:00:00')) // returns "1" - which is
wrong as DST is Summer time!
This issue seems to happen specifically on Amazon AWS EC2 instances.
A newly installed server instance returns the correct value for around a
day, but then it seems to switch over.
We weren't able to replicate this issue on a non-AWS instance.
Test script:
---------------
date_default_timezone_set('Europe/London');
if (date('I', strtotime('2018-09-29 02:00:00'))) {
echo 'We are in DST!';
} else {
echo 'We are not in DST!';
}
date_default_timezone_set('Europe/Dublin');
if (date('I', strtotime('2018-09-29 02:00:00'))) {
echo 'We are in DST!';
} else {
echo 'We are not in DST!';
}
date_default_timezone_set('Europe/Paris');
if (date('I', strtotime('2018-09-29 02:00:00'))) {
echo 'We are in DST!';
} else {
echo 'We are not in DST!';
}
Expected result:
----------------
We are in DST!
We are in DST!
We are in DST!
Actual result:
--------------
We are in DST!
We are not in DST!
We are in DST!
--
Edit bug report at https://bugs.php.net/bug.php?id=76983&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76983&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76983&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76983&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76983&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76983&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76983&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76983&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76983&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76983&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76983&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76983&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76983&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76983&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76983&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76983&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76983&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76983&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76983&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76983&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76983&r=mysqlcfg