Page MenuHomePhabricator

Reply tool doesn't appear at some wikis, possibly due to timestamp formatting
Open, Needs TriagePublic

Description

The Reply tool doesn't appear on pages at these wikis:

  • thwiki – timestamp says 23:33, 14 ตุลาคม 2563 (+07)
  • mnwwiki – timestamp says ၂၃:၀၇၊ ၁၄ အံက်တဝ်ပါ ၂၀၂၀ (+0630)
  • maiwiki – timestamp says २२:२४, १४ अक्टुबर २०२० (+0545)
  • newiki – timestamp says २२:२५, १४ अक्टोबर २०२० (नेपाली समय)

Testing instructions

  1. Enable the DiscussionTools Beta Feature at each of the wikis listed in the table below.
  2. Visit each of the "Talk page URLs" listed in the table below
  3. Verify [ reply ] links are being appended to comments as expected [i]
WikiTalk page URL
th.wikihttps://w.wiki/gyr
mnw.wikihttps://w.wiki/gyo
mai.wikihttps://w.wiki/gyn
ne.wikihttps://w.wiki/gyp

i. https://www.mediawiki.org/wiki/Help:DiscussionTools/Why_can%27t_I_reply_to_this_comment%3F

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptWed, Oct 14, 4:41 PM
matmarex claimed this task.Wed, Oct 14, 5:28 PM
matmarex added a subscriber: matmarex.

It looks like DateTime::format( 'T' ) and DateTimeZone::listAbbreviations() produce different abbreviations for these timezones, which I didn't know was possible. E.g. on thwiki, the timezone is Asia/Bangkok, the former outputs "+07" and the latter "BMT", and that is the reason why we don't recognize the timestamps.

Change 634073 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@master] Correctly generate timezone abbreviations for parsing

https://gerrit.wikimedia.org/r/634073

Change 634073 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Correctly generate timezone abbreviations for parsing

https://gerrit.wikimedia.org/r/634073

Change 634249 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@wmf/1.36.0-wmf.11] Correctly generate timezone abbreviations for parsing

https://gerrit.wikimedia.org/r/634249

Change 634250 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/DiscussionTools@wmf/1.36.0-wmf.13] Correctly generate timezone abbreviations for parsing

https://gerrit.wikimedia.org/r/634250

Backporting to wmf.11 and wmf.13:

  • wmf.11 is currently deployed on Wikipedias
  • wmf.12 was cancelled (T263178)
  • wmf.13 is due to roll out in a few hours, but there are still a few blockers, so it might not happen today (T263179)

Scheduled for today, in about 2 hours: https://wikitech.wikimedia.org/wiki/Deployments#deploycal-item-20201015T1800

Thank you for doing this, Bartosz.

Change 634249 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@wmf/1.36.0-wmf.11] Correctly generate timezone abbreviations for parsing

https://gerrit.wikimedia.org/r/634249

Change 634250 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@wmf/1.36.0-wmf.13] Correctly generate timezone abbreviations for parsing

https://gerrit.wikimedia.org/r/634250

Mentioned in SAL (#wikimedia-operations) [2020-10-15T19:16:42Z] <catrope@deploy1001> Synchronized php-1.36.0-wmf.13/extensions/DiscussionTools/: Correctly generate timezone abbreviations for parsing (T265500) (duration: 01m 51s)

Mentioned in SAL (#wikimedia-operations) [2020-10-15T19:20:04Z] <catrope@deploy1001> Synchronized php-1.36.0-wmf.11/extensions/DiscussionTools/: Correctly generate timezone abbreviations for parsing (T265500) (duration: 01m 29s)

Seems to work now on thwiki and newiki at a glance. I couldn't easily find a suitable discussion page to test on the others – it looks like their date formats or timezones changed recently, and timestamps generated before the change won't be recognized by DiscussionTools. The regular QA in T264693 should cover them, I guess.

Also, some further details on why this happened.

It looks like DateTime::format( 'T' ) and DateTimeZone::listAbbreviations() produce different abbreviations for these timezones, which I didn't know was possible. E.g. on thwiki, the timezone is Asia/Bangkok, the former outputs "+07" and the latter "BMT", and that is the reason why we don't recognize the timestamps.

I tried finding out where the list produced by DateTimeZone::listAbbreviations() / timezone_abbreviations_list() comes from.

It's defined in the source code here: https://github.com/php/php-src/blob/master/ext/date/lib/timezonemap.h – you can search for "Asia/Bangkok" and see that the only abbreviation for it is "bmt". Similarly for "Asia/Yangon" → "rmt" (mnwwiki), and "Asia/Kathmandu" doesn't appear at all (maiwiki and newiki).

Instead, the abbreviations should be "+07", "+0630" and "+0545" respectively. I don't know why these are used, but that's what's defined in the tz database (apparently there is no nice way to browse it anywhere on the internet, but you can download the data from https://www.iana.org/time-zones and see for yourself), and that is what PHP uses everywhere else, and it's what MediaWiki uses when generating signatures.

I tried digging where exactly the incorrect data in timezonemap.h comes from. It comes from the output of this script: https://github.com/derickr/timelib/blob/master/gettzmapping.php and on line 778 and 781, it discards timezone abbreviations that are a plus or minus sign, followed by two or four digits.

Apparently the whole complicated mess exists primarily to support the function called timezone_name_from_abbr(), which is entirely useless, because the abbreviations do not uniquely identify timezones (e.g. PST is used for both 'America/Los_Angeles' – Pacific Standard Time and 'Asia/Manila' – Philippine Standard Time). Even if you supply the time offset too, it is still useless, because you can't distinguish e.g. the MST abbreviation of Mountain Standard Time, used for both 'America/Denver' (which uses daylight saving time, and becomes MDT) from 'America/Phoenix' (which does not).

This is one of the parts of PHP that should come with big "DO NOT USE" labels on it, but it does not, and we accidentally used it.

ppelberg updated the task description. (Show Details)Fri, Oct 16, 12:28 AM

Seems to work now on thwiki and newiki at a glance. I couldn't easily find a suitable discussion page to test on the others – it looks like their date formats or timezones changed recently, and timestamps generated before the change won't be recognized by DiscussionTools. The regular QA in T264693 should cover them, I guess.

Thanks, Bartosz. I've updated the task description with links to talk pages where we can test this. A quick pass leads me to think that [ reply ] links are now appearing as expected at the affected wikis.

Assigning this over to @Ryasmeen to verify.

ppelberg reassigned this task from matmarex to Ryasmeen.Fri, Oct 16, 12:32 AM
ppelberg added a project: Editing QA.