As noted in T318455#8301251, UserTimeCorrection::parse silently clamps offsets between -12 and +14, without saying anything to its callers (and thus, to users). This should be changed so that invalid values can be handled as appropriate, e.g. by informing the user that they entered an invalid value.
Description
Details
Related Objects
- Mentioned In
- T320359: Reject registration creation/edit if the timezone offset is < -12 or > 14
T318455: "time offset from UTC" timezone option in Special:Preferences doesn't work with negative offsets with minutes - Mentioned Here
- T322352: Clean up handling of timezones in preferences code and friends
rUCAMd716fee637bb: Work around PHP bugs in timezone validation
T318455: "time offset from UTC" timezone option in Special:Preferences doesn't work with negative offsets with minutes
Event Timeline
Sure, it annoys me as well, so I'll definitely review it. We would also benefit from proper error handling in CampaignEvents.
Change 840309 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):
[mediawiki/core@master] preferences: Show errors about invalid timezone instead of silently correcting
Change 840309 merged by jenkins-bot:
[mediawiki/core@master] preferences: Show errors about invalid timezone instead of silently correcting
Then I think the validation should happen in HTMLTimezoneField::validate() instead of validation-callback for user preferences only.
Commit d716fee for CampaignEvents extension added more validations, do we need that in core?
Sounds reasonable.
Commit d716fee for CampaignEvents extension added more validations, do we need that in core?
I would say yes
Change 881381 had a related patch set uploaded (by Func; author: Func):
[mediawiki/core@master] Move validation of timezone to HTMLTimezoneField
I tested the given cases manually, and all of them can be identified as invalid correctly by ( new UserTimeCorrection( $value ) )->isValid(), so I didn't include extra validations.
Right, because the code in CampaignEvents uses PHP's DateTimeZone directly. I think we *may* have to reconsider this as part of T322352, but that's for another day.
Change 881381 merged by jenkins-bot:
[mediawiki/core@master] Move validation of timezone to HTMLTimezoneField