Log warning and show error on empty username
authorAryeh Gregor <ayg@aryeh.name>
Mon, 6 May 2019 08:58:09 +0000 (11:58 +0300)
committerBill Pirkle <bpirkle@wikimedia.org>
Mon, 6 May 2019 19:44:23 +0000 (14:44 -0500)
commitddd1d4b9203aa3b516afbb099b6819a42df6faec
treec6c2f687ee45bc6d4035e4e5721eb6902350c83c
parentc3d8fa1fc3c77c59bd44b25b3836069930ab515a
Log warning and show error on empty username

Historically it seems that if Linker::userLink or friends were passed an
empty username (probably due to an incorrect database entry), they would
produce bogus output, e.g., an <a> with no contents or a link to the
invalid page "User_talk:" or similar.

In b6e1e99bec8d we replaced an occurrence of Title::makeTitle() (no
safety checks!) with creating a TitleValue, which asserts in its
constructor that the title text is not empty. This made such pages fail
an assertion and stop displaying at all.

Now there's a proper check for the error. Such cases will log a
production error and return "(no username available)".

Bug: T222529
Change-Id: Id65bdf9666b0d16e5553b8f38c7cf8fce2e37a25
RELEASE-NOTES-1.34
includes/Linker.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/phpunit/includes/LinkerTest.php