Page MenuHomePhabricator

Error: Call to a member function getId() on null (in ApiCoreThank)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Logstash query: "Call to a member function getId() on null" AND "ApiCoreThank"

image.png (535×2 px, 112 KB)

Code location: https://gerrit.wikimedia.org/g/mediawiki/extensions/Thanks/ /6dec889252dc13120bc802d32778ab39e4b9608c/includes/Api/ApiCoreThank.php#202

$recipient = $revision->getUser()->getId();
normalized_message
[{reqId}] {exception_url}   Error: Call to a member function getId() on null
exception.trace
from /srv/mediawiki/php-1.41.0-wmf.13/extensions/Thanks/includes/Api/ApiCoreThank.php(202)
#0 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Thanks/includes/Api/ApiCoreThank.php(100): MediaWiki\Extension\Thanks\Api\ApiCoreThank->getUserFromRevision(MediaWiki\Revision\RevisionStoreRecord)
#1 /srv/mediawiki/php-1.41.0-wmf.13/includes/api/ApiMain.php(1913): MediaWiki\Extension\Thanks\Api\ApiCoreThank->execute()
#2 /srv/mediawiki/php-1.41.0-wmf.13/includes/api/ApiMain.php(859): ApiMain->executeAction()
#3 /srv/mediawiki/php-1.41.0-wmf.13/extensions/Thanks/includes/SpecialThanks.php(178): ApiMain->execute()
#4 /srv/mediawiki/php-1.41.0-wmf.13/includes/htmlform/HTMLForm.php(746): MediaWiki\Extension\Thanks\SpecialThanks->onSubmit(array, OOUIHTMLForm)
#5 /srv/mediawiki/php-1.41.0-wmf.13/includes/htmlform/HTMLForm.php(626): HTMLForm->trySubmit()
#6 /srv/mediawiki/php-1.41.0-wmf.13/includes/htmlform/HTMLForm.php(642): HTMLForm->tryAuthorizedSubmit()
#7 /srv/mediawiki/php-1.41.0-wmf.13/includes/specialpage/FormSpecialPage.php(224): HTMLForm->show()
#8 /srv/mediawiki/php-1.41.0-wmf.13/includes/specialpage/SpecialPage.php(701): FormSpecialPage->execute(string)
#9 /srv/mediawiki/php-1.41.0-wmf.13/includes/specialpage/SpecialPageFactory.php(1558): SpecialPage->run(string)
#10 /srv/mediawiki/php-1.41.0-wmf.13/includes/MediaWiki.php(328): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#11 /srv/mediawiki/php-1.41.0-wmf.13/includes/MediaWiki.php(925): MediaWiki->performRequest()
#12 /srv/mediawiki/php-1.41.0-wmf.13/includes/MediaWiki.php(579): MediaWiki->main()
#13 /srv/mediawiki/php-1.41.0-wmf.13/index.php(50): MediaWiki->run()
#14 /srv/mediawiki/php-1.41.0-wmf.13/index.php(46): wfIndexMain()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}
Impact

Minimal, very few occurrences.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I noticed these while looking at T335515. RevisionRecord::getUser() can return null when the author of the revision has been hidden. Seems like that case should be handled (by removing the ability to send thanks for such edits).

Change 951156 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/Thanks@master] ApiCoreThank: Fix handling of hidden author of revision

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

Change 951156 merged by jenkins-bot:

[mediawiki/extensions/Thanks@master] ApiCoreThank: Fix handling of hidden author of revision

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

Umherirrender assigned this task to matmarex.