Page MenuHomePhabricator

TypeError: Argument 1 passed to LogFormatter::makeUserLink() must implement interface MediaWiki\User\UserIdentity, bool given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
message
[{reqId}] {exception_url}   TypeError: Argument 1 passed to LogFormatter::makeUserLink() must implement interface MediaWiki\User\UserIdentity, bool given, called in /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/BlockLogFormatter.php on line 52
trace
from /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/LogFormatter.php(870)
#0 /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/BlockLogFormatter.php(52): LogFormatter->makeUserLink(bool, int)
#1 /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/LogFormatter.php(565): BlockLogFormatter->getMessageParameters()
#2 /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/LogFormatter.php(540): LogFormatter->getActionMessage()
#3 /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/LogEventsList.php(341): LogFormatter->getActionText()
#4 /srv/mediawiki/php-1.43.0-wmf.20/includes/logging/LogPager.php(460): LogEventsList->logLine(stdClass)
#5 /srv/mediawiki/php-1.43.0-wmf.20/includes/pager/ReverseChronologicalPager.php(134): MediaWiki\Pager\LogPager->formatRow(stdClass)
#6 /srv/mediawiki/php-1.43.0-wmf.20/includes/pager/IndexPager.php(601): MediaWiki\Pager\ReverseChronologicalPager->getRow(stdClass)
#7 /srv/mediawiki/php-1.43.0-wmf.20/includes/specials/SpecialLog.php(317): MediaWiki\Pager\IndexPager->getBody()
#8 /srv/mediawiki/php-1.43.0-wmf.20/includes/specials/SpecialLog.php(195): MediaWiki\Specials\SpecialLog->show(MediaWiki\Html\FormOptions, array)
#9 /srv/mediawiki/php-1.43.0-wmf.20/includes/specialpage/SpecialPage.php(719): MediaWiki\Specials\SpecialLog->execute(null)
#10 /srv/mediawiki/php-1.43.0-wmf.20/includes/specialpage/SpecialPageFactory.php(1705): MediaWiki\SpecialPage\SpecialPage->run(null)
#11 /srv/mediawiki/php-1.43.0-wmf.20/includes/actions/ActionEntryPoint.php(502): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#12 /srv/mediawiki/php-1.43.0-wmf.20/includes/actions/ActionEntryPoint.php(145): MediaWiki\Actions\ActionEntryPoint->performRequest()
#13 /srv/mediawiki/php-1.43.0-wmf.20/includes/MediaWikiEntryPoint.php(200): MediaWiki\Actions\ActionEntryPoint->execute()
#14 /srv/mediawiki/php-1.43.0-wmf.20/index.php(58): MediaWiki\MediaWikiEntryPoint->run()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}
Impact

Loading Special:Log causes a FatalError, which makes the relevant log inaccessible

Details

Request URL
https://en.wikipedia.org/w/index.php?title=Special:Log&logid=912943
Related Changes in Gerrit:

Event Timeline

Dreamy_Jazz changed Request URL from https://en.wikipedia.org/w/index.php?limit=1&offset=20051113165350&title=Special:Log&type=block&user= to https://en.wikipedia.org/w/index.php?title=Special:Log&logid=912943.Sep 3 2024, 7:32 PM

The problematic log ID is 912943

Presumably the creation of the User returned false as it was a temporary account or similar?

The log from the DB:

(enwiki)> select * from logging where log_id = 912943;
+--------+----------+------------+----------------+---------------+-------------+----------------+------------+-------------+-----------+----------+
| log_id | log_type | log_action | log_timestamp  | log_namespace | log_title   | log_comment_id | log_params | log_deleted | log_actor | log_page |
+--------+----------+------------+----------------+---------------+-------------+----------------+------------+-------------+-----------+----------+
| 912943 | block    | unblock    | 20051113165347 |             2 | User:#57770 |      265369094 |            |           0 |   1141332 |     NULL |
+--------+----------+------------+----------------+---------------+-------------+----------------+------------+-------------+-----------+----------+
1 row in set (0.001 sec)

Presumably the creation of the User returned false as it was a temporary account or similar?

Doesn't look like it, considering that the log is from 2005.

My thinking is that the log entry's log_title has the namespace there when it shouldn't be present. The code that checks for auto-blocks only checks the first character for the # character.

Running a LIKE query suggests there are around 7,000 entries in the logging table where the log_title starts with User:. Not sure if all of these are related to this, but we can fix this occurrence and I can run further queries.

Update: Running a query for logging table entries with log_title starting with User:# gives me a grand total of one :D

I could run an update query to fix this, but perhaps we should consider a maintenance script to fix broken entries that may exist on other wikis?

Change #1070541 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Fix old autoblock unblock log entries with namespace in log_title

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

Change #1070541 merged by jenkins-bot:

[mediawiki/core@master] Fix old autoblock unblock log entries with namespace in log_title

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

I can run the script on production once wmf.23 reaches all wikis next week.

Mentioned in SAL (#wikimedia-operations) [2024-09-20T14:08:25Z] <Dreamy_Jazz> Running foreachwiki maintenance/fixAutoblockLogTitles.php on a tmux session for T373929

Mentioned in SAL (#wikimedia-operations) [2024-09-20T14:20:37Z] <Dreamy_Jazz> Finished running`foreachwiki maintenance/fixAutoblockLogTitles.php` on a tmux session for T373929