Page MenuHomePhabricator

Warning: get_class expects object (string given) from EventBusHooks.php
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Request ID: XJPt6gpAIEIAAK4U9D0AAACP

message
[{exception_id}] {exception_url} ErrorException from line 478 of /srv/mediawiki/php-1.33.0-wmf.22/extensions/EventBus/includes/EventBusHooks.php: PHP Warning: get_class() expects parameter 1 to be object, string given
trace
#1 /srv/mediawiki/php-1.33.0-wmf.22/includes/Hooks.php(174): EventBusHooks::onBlockIpComplete(Block, User, NULL)
#2 /srv/mediawiki/php-1.33.0-wmf.22/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#3 /srv/mediawiki/php-1.33.0-wmf.22/includes/specials/SpecialBlock.php(970): Hooks::run(string, array)
#4 /srv/mediawiki/php-1.33.0-wmf.22/includes/specials/SpecialBlock.php(1217): SpecialBlock::processForm(array, RequestContext)
#5 /srv/mediawiki/php-1.33.0-wmf.22/includes/htmlform/HTMLForm.php(661): SpecialBlock->onSubmit(array, OOUIHTMLForm)
#6 /srv/mediawiki/php-1.33.0-wmf.22/includes/htmlform/HTMLForm.php(553): HTMLForm->trySubmit()
#7 /srv/mediawiki/php-1.33.0-wmf.22/includes/htmlform/HTMLForm.php(568): HTMLForm->tryAuthorizedSubmit()
#8 /srv/mediawiki/php-1.33.0-wmf.22/includes/specialpage/FormSpecialPage.php(184): HTMLForm->show()
#9 /srv/mediawiki/php-1.33.0-wmf.22/includes/specialpage/SpecialPage.php(569): FormSpecialPage->execute(string)
#10 /srv/mediawiki/php-1.33.0-wmf.22/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(string)
#11 /srv/mediawiki/php-1.33.0-wmf.22/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#12 /srv/mediawiki/php-1.33.0-wmf.22/includes/MediaWiki.php(867): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.33.0-wmf.22/includes/MediaWiki.php(517): MediaWiki->main()
#14 /srv/mediawiki/php-1.33.0-wmf.22/index.php(42): MediaWiki->run()
#15 /srv/mediawiki/w/index.php(3): require(string)

Impact

Unknown.

The error is non-fatal, which means the program continues as if nothing was wrong, which means it is likely behaving incorrectly and/or producing misleading data.

Notes

It happens on multiple wikis. Most urls are "Special:Block" or a translation thereof (I think).

Has been record in Logstash for at least 30 days, by version:

CountFile path
5/srv/mediawiki/php-1.33.0-wmf.22/extensions/EventBus/includes/EventBusHooks.php:478
83/srv/mediawiki/php-1.33.0-wmf.21/extensions/EventBus/includes/EventBusHooks.php:496
39/srv/mediawiki/php-1.33.0-wmf.20/extensions/EventBus/includes/EventBusHooks.php:496
246/srv/mediawiki/php-1.33.0-wmf.19/extensions/EventBus/includes/EventBusHooks.php:496
38/srv/mediawiki/php-1.33.0-wmf.18/extensions/EventBus/includes/EventBusHooks.php:478
12/srv/mediawiki/php-1.33.0-wmf.17/extensions/EventBus/includes/EventBusHooks.php:478

Event Timeline

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

Tagging AHT as this affect events from onBlockIpComplete, which might be of interest to you.

Change 498251 had a related patch set uploaded (by Mobrovac; owner: Mobrovac):
[mediawiki/extensions/EventBus@master] onBlockIpComplete: Check that $blockTarget is an object

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

mobrovac subscribed.

The code actually behaves correctly, since a block target can be a user, user ID or their IP. However, get_class() emits a warning for anything that's not an object. The above patch checks for this before invoking get_class(). Thank you for reporting @Krinkle .

Change 498251 merged by jenkins-bot:
[mediawiki/extensions/EventBus@master] onBlockIpComplete: Check that $blockTarget is an object

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

Tagging AHT as this affect events from onBlockIpComplete, which might be of interest to you.

Thank you @Krinkle. Looks like this has been resolved already.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM