-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-#18051 (DateTimeZone->getTransitions can return first transition twice) #18054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix GH-#18051 (DateTimeZone->getTransitions can return first transition twice) #18054
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but with a comment to address first.
ext/date/php_date.c
Outdated
add_assoc_bool(&element, "isdst", tzobj->tzi.tz->type[i].isdst); \ | ||
add_assoc_string(&element, "abbr", &tzobj->tzi.tz->timezone_abbr[tzobj->tzi.tz->type[i].abbr_idx]); \ | ||
add_next_index_zval(return_value, &element); | ||
if (timestamp_added_last != ts) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DItto
c3df98b
to
18350af
Compare
@derickr It turns out that the transitions are not sequential in all cases - at least not on 32bit. var_dump(array_slice(new DateTimeZone("America/New_York")->getTransitions(), 0, 3));
|
@derickr Using a different approach now to avoid one variable and some assignments / comparisons. |
They should definitely be sequential. Something else odd is going on here. |
7e136cf
to
e9ed392
Compare
…ition twice + integer overflow)
e9ed392
to
cc1c5a0
Compare
OK, they are sequential, but the transitions are all int64 and the second transition of The changes in this PR are fixing this issue as well. Here is what is happening on America/New_York
|
This PR fixes duplicated transitions in
DateTimeZone->getTransitions()
by memorizing the last transition timestamp reported before the next transition gets added to the resulting array.