From: eclipsechasers2 at yahoo dot com Operating system: Windows and Linux PHP version: 5.4.16 Package: Date/time related Bug Type: Bug Bug description:dst not handled past 2038
Description: ------------ This could be considered a duplicate of bug 42842. That bug was marked suspended in 2007. The reasons for its suspension are no longer valid. I updated that ticket, but, after a week with no feedback whatsoever, am opening a new ticket in the hope that it will get a reply. PHP does not handle dst transitions from the year 2038 on. This happens on Windows and Linux, on 32- and 64-bit systems. It happens with all releases, including the most current (5.4.16), and even when PECL is used to install timezonedb. The reason the ticket was suspended was "the timezone database simply doesn't have the resolution to store anything outside of the signed integer range for now." That is no longer true, and a 5-year delay seems time enough to implement it in PHP. The Unix zdump command handles the transition on 64-bit Linux systems (including the latest Ubuntu). Perl handles the transition on Windows and Linux, even on 32-bit systems. Test script: --------------- <?php $firstyear = 2035; $lastyear = 2040; $tz = 'America/Los_Angeles'; date_default_timezone_set('America/Los_Angeles'); $dt = new DateTime((string) ($firstyear - 1) . "-07-02"); $di = new DateInterval('P6M'); for ($i = 0; $i < ($lastyear - $firstyear) * 2; $i++) { $dt->add($di); $gmto = $dt->getOffset(); echo "Time Zone offset for $tz for " , $dt->format('Y-m-d') , " is $gmto\n"; } ?> Expected result: ---------------- Time Zone offset for America/Los_Angeles for 2035-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2035-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2036-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2036-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2037-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2037-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2038-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2038-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2039-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2039-07-02 is -25200 Actual result: -------------- Time Zone offset for America/Los_Angeles for 2035-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2035-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2036-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2036-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2037-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2037-07-02 is -25200 Time Zone offset for America/Los_Angeles for 2038-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2038-07-02 is -28800 Time Zone offset for America/Los_Angeles for 2039-01-02 is -28800 Time Zone offset for America/Los_Angeles for 2039-07-02 is -28800 The lines for 2038-07-2 and 2039-07-02 are wrong; they should show -25200. A zdump command which shows the correct values is: zdump -v -c 2035,2039 America/Los_Angeles Here is an equivalent Perl script which displays all the lines correctly: #!/usr/bin/perl -w use strict; use DateTime; my $firstyear = 2035; my $lastyear = 2040; my $tz = 'America/Los_Angeles'; my $dt = DateTime->new(year=>($firstyear - 1), month=>7, day=>2, time_zone=>$tz); for (my $i = 0; $i < ($lastyear - $firstyear) * 2; $i++) { $dt->add(months=>6); my $gmto = $dt->offset(); printf "Time Zone offset for $tz for " . $dt->ymd('-') . " is $gmto\n"; } -- Edit bug report at https://bugs.php.net/bug.php?id=64992&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64992&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64992&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64992&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64992&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64992&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64992&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64992&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64992&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64992&r=support Expected behavior: https://bugs.php.net/fix.php?id=64992&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64992&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64992&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64992&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64992&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64992&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64992&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64992&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64992&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64992&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64992&r=mysqlcfg