Page MenuHomePhabricator

Inclusion is broken in MW1.34 (shows warnings and generates no output)
Open, Needs TriagePublic

Description

I updated from MediaWiki 1.31 to 1.34 and thus from Contributors "2.0 (bf42ccf) 03:30, 22. Nov. 2017" to "2.0 (04de8a2) 08:36, 10. Sep. 2019".

After running

php extensions/Contributors/maintenance/PopulateContributorsTable.php

the special page "Special:Contributors" works as expected.

But the inclusion with {{Special:Contributors/Article}} generates no output at all. It only shows 2 warnings:

Warning: array_keys() expects parameter 1 to be array, null given in
/html/site/mediawiki/extensions/Contributors/includes/Contributors.php on line 187

Warning: Invalid argument supplied for foreach() in
/html/site/mediawiki/extensions/Contributors/includes/Contributors.php on line 196
`

Changing to the master version of the extension doesn't fix the error.

Update: I'm not the only one with this error message. See the third pic on https://github.com/wikimedia/mediawiki-extensions-Contributors/issues/3.

Who can fix this please?

Event Timeline

Stefahn created this task.Feb 2 2020, 8:58 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptFeb 2 2020, 8:58 PM
Stefahn updated the task description. (Show Details)Feb 2 2020, 9:00 PM
Stefahn updated the task description. (Show Details)
Aklapper renamed this task from Inclusion is broken (shows warnings and generates no output) to Inclusion is broken in MW1.34 (shows warnings and generates no output).Feb 4 2020, 1:14 PM

Just tested this with the newest master version (227c18b from 31. May 2020) but no luck: The inclusion still not works and throws the two mentioned warnings.

Since the version 04de8a2 also threw those 2 warnings, and there were no code changes to /includes/Contributors.php since November 2017 (except one newline), something else must have changed (core?).

Can someone please fix this error, maybe @thiemowmde (you committed to the extension in February I saw) ?
This extension is the only reason that blocks me from finally updating my wiki (with 50.000 visitors per month) from MW 1.31 to 1.34... Thanks a lot in advance!

Change 602447 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Contributors@master] Hot-fix for errors caused by uninitialized $contributors property

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

Change 602453 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/Contributors@master] Restore broken parser function and include features

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

Change 602447 merged by jenkins-bot:
[mediawiki/extensions/Contributors@master] Hot-fix for errors caused by uninitialized $contributors property

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

I did a Git bisect and found the patch that essentially killed the extension. It happened in 2016, in patch https://gerrit.wikimedia.org/r/301876 by @Devirk, merged by @Addshore, tracked via T139879. I tried to understand what happened back then and left a few comments on the patch. If I'm not mistaken, the patch killed most features of the extension (the parser function, the possibility to include the special page, the possibility to get raw data, possibly even the API), except normal usages of the special page.

Why do we see this now, you might ask. I think this is because a recent version of PHP started to complain when you try to run array_keys on null.

Another patch, also from 2016, killed more features, without mentioning this anywhere. See https://gerrit.wikimedia.org/r/297264.

I uploaded a bunch of patches where I try to restore some kind of order, without fully understanding what the meaning of these older patches was, which features have been intentionally killed, and what was a mistake.

Thanks @thiemowmde for all your work. I installed b1a1ff7. This removes the warnings, but when using

{{Special:Contributors/Article}}

it doesn't output anything (except <p><br /></p>).

The special page Special:Contributors works fine, so the data seems to be in place.

Any chance someone can have a look at the inclusion part and get it back running? That would be so great since I use {{Special:Contributors/Article}} in every article to honor my co-editors.

I know. A fix for this exists as well, see https://gerrit.wikimedia.org/r/602453. What I don't understand yet: It appears like this extension is broken for 4 years. How is it possible nobody was running into this issue for such a long time?

Thanks. I downloaded your latest change (https://phabricator.wikimedia.org/rECNNbf42ccf671483f117d3d0282a6587f8dd3df0a90). The inclusion works :) I can't help with reviewing though since I'm not a expert in PHP and Gerrit.

How is it possible nobody was running into this issue for such a long time?

Good question. I was working with bf42ccf, which was not from the master branch. There a lot of (stale) branches in the repository. Maybe only the master branch was broken for 4 years, the other's weren't?

According to https://wikiapiary.com/wiki/Extension:Contributors most users are on version 2.0 using MW 1.31. As far as I remember this combination didn't throw errors and the inclusion was still working.

Someone would need to review it and the Wikimedia movement in general isn't traditionally great in this. :-/
mw:Extension:Contributors lists @Yaron_Koren as maintainer (not sure that's still correct though).
Also wondering if Yaron_Koren watches the Contributors project in Gerrit?

@Aklapper - I'm no longer involved with Contributors at all. I did maintain the extension briefly in 2014 or so, but I haven't looked at it since - and the extension was modified pretty significantly in a 2016 Google Summer of Code project: T129123. I just removed myself as the maintainer on the mediawiki.org page.

Ah, thanks for the cleanup! :)