You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DateTimeZone::getTransitions() returns insufficient data #7752
It seems that transitions are not tracked far in the future, and that neither version is totally correct; apparently, prior to PHP 8.1.0 DST was always assumed, while as of PHP 8.1.0 standard time is assumed (what would make more sense).
changed the title [-]Datetime with 2203 year has a different timestamp in PHP 8.1[/-][+]DateTimeZone::getTransitions() returns insufficient data[/+]on Dec 14, 2021
There is apparently something wrong with reading the timezone DB in PHP 8.1. Although both have identical timezonedb.h files, for America/Los_Angeles, PHP 8.0 reads timelib_tzinfo->64bit.timecnt == 186, while PHP 8.1 reads timelib_tzinfo->64bit.timecnt == 125.
@derickr, any idea what change in timelib may have caused this?
First of all, the PHP 8.1.x result is correct in @mvorisek example.
Before PHP 8.1, transitions were only tracked until 2100. Anything after that, used the last rule. For Los_Angeles, that would have been UTC-8 (incorrectly).
In PHP 8.1 and later, timelib has implemented support for POSIX TZ strings, which allow to calculate transitions with the existing rules.
Operating Systems changed their tzdata format from "fat" to "small", and the latter only includes transitions up until the last change in DST rules. For anything beyond that, POSIX TZ strings must now be used. (This explains the discrepancies between different distributions of the same PHP version)
This means that it can now knows about DST in 2203, where UTC-7 applies: string(25) "2203-10-05T15:05:37-07:00"
Activity
jellynoone commentedon Dec 10, 2021
It seems the bug starts with
2100-03-14 03:00:00while2100-03-14 02:59:59works fine.On PHP 8.1
2100-03-14 03:00:00under theAmerica/Los_Angelestime zone has the same timestamp as2100-03-14 02:00:00.cmb69 commentedon Dec 10, 2021
It seems that transitions are not tracked far in the future, and that neither version is totally correct; apparently, prior to PHP 8.1.0 DST was always assumed, while as of PHP 8.1.0 standard time is assumed (what would make more sense).
@derickr, can you please clarify?
iluuu1994 commentedon Dec 10, 2021
https://3v4l.org/1Oe8V
All transitions in the future except for the next seem to be gone. (might be by design, not sure)
derickr commentedon Dec 10, 2021
I'm going to have to check this, as the new code should definitely handle this correctly.
[-]Datetime with 2203 year has a different timestamp in PHP 8.1[/-][+]DateTimeZone::getTransitions() returns insufficient data[/+]DevSysEngineer commentedon Feb 17, 2022
Can some one tell when this issue will be fixed? We added now hacks in our code base for getting now the correct timestamp.
cmb69 commentedon Feb 18, 2022
There is apparently something wrong with reading the timezone DB in PHP 8.1. Although both have identical timezonedb.h files, for America/Los_Angeles, PHP 8.0 reads
timelib_tzinfo->64bit.timecnt == 186, while PHP 8.1 readstimelib_tzinfo->64bit.timecnt == 125.@derickr, any idea what change in timelib may have caused this?
hormus commentedon Mar 24, 2022
https://bugs.php.net/bug.php?id=80963
It's broken.
@CMB @derickr without if !isset($is_dst) || !$is_dst
https://3v4l.org/es6E4
bobvandevijver commentedon Mar 28, 2022
Interestingly, I'm seeing different results with different installations. Consider the following command:
It returns 7 records on:
It returns 1 record on:
derickr commentedon Apr 1, 2022
Hi, there are bunch of things going on here.
UTC-8(incorrectly).UTC-7applies:string(25) "2203-10-05T15:05:37-07:00"Fixed #7752, #8101, #81660: DateTimeZone::getTransitions() returns in…
reloxx13 commentedon May 5, 2023
How many years left for the 8.2.6 release including this important bug fix for date/time?
UTC->Europe/Berlin
7.4 date correct (5.5.2023)
7.4 -> 8.1.5 = date wrong (6.5.2023)
7.4 -> 8.0.25 = date correct (6.5.2023)
You are producing so many headaches, work and money lost by not releasing the fix for over a year for many companies.
damianwadley commentedon May 5, 2023
@reloxx13 The bug reported here was fixed. If you think you have a new bug then create a new issue for it.