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
Fix GH-24735: Resolve repeated local times consistently - #24738
Quoted below: written with Claude, an LLM, as CONTRIBUTING.md asks us to mark. The builds and test runs behind it are on my machine; the commands to repeat them are under the fold.
This fixes the issue's case, but a time in the second occurrence of the repeated hour now goes back to the first, in London as well as Dublin. On today's PHP-8.5 (6a020d606e4) with this applied, debug builds, 2026-10-25:
Start
then
PHP-8.5
this PR
Dublin 01:10:30 IST (first)
setTime(1, 10, 59)
01:10:59 GMT (+3629s)
01:10:59 IST (+29s)
Dublin 01:10:30 GMT (second)
setTime(1, 10, 59)
01:10:59 GMT (+29s)
01:10:59 IST (−3571s)
London 01:10:30 BST (first)
setTime(1, 10, 59)
01:10:59 BST (+29s)
01:10:59 BST (+29s)
London 01:10:30 GMT (second)
setTime(1, 10, 59)
01:10:59 GMT (+29s)
01:10:59 BST (−3571s)
modify('+29 seconds') gives the same result as setTime() in every row. A time in the spring-forward gap (01:30 on 2026-03-29) comes out the same on both builds, and ext/date/tests passes on both (694 tests; 695 with this one's).
So it seems to prefer the first occurrence even when the time started in the second; keeping the offset the time already had, whenever that offset is valid for the new wall time, would cover both. A test with a start in the second occurrence would catch it.
Also, since this changes ext/date/lib: that's timelib (https://github.com/derickr/timelib), and its logic changes have come into php-src through timelib releases (d83851dae86, "Update timelib to 2022.17", for one). Should this go to timelib first?
How this was tested
Linux x86_64, gcc 13.3, debug builds of origin/PHP-8.5 and of it with this PR's commit cherry-picked:
Overlap resolution now preserves the starting UTC offset when it remains valid, falling back to the earlier occurrence otherwise. Added regression coverage for setTime() and modify() starting in the second occurrence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24735.