Page MenuHomePhabricator

ErrorException from line 118 in DisplayTitleHooks.php: PHP Warning: get_class() expects parameter 1 to be object, integer given
Closed, ResolvedPublic

Description

Setup

  • MediaWiki 1.30.0-rc.0 (6354fbf) 00:36, 22 November 2017
  • PHP 5.6.30-0+deb8u1 (apache2handler)
  • MariaDB 10.0.33-MariaDB-1~jessie
  • DisplayTitle 1.5.3 (b203042) 01:39, 25 November 2017

Issue
--> observed here

2017-11-29 19:37:06 phalaris 0210020150926-02100_: [580b136b2f65706e49f698a8] /w/index.php?hide_thanks_log=0&printable=yes&title=Sp%C3%A9cial:Journal/Oetterer   ErrorException from line 118 of /../w/extensions/DisplayTitle/includes/DisplayTitleHooks.php: PHP Warning: get_class() expects parameter 1 to be object, integer given
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /../w/extensions/DisplayTitle/includes/DisplayTitleHooks.php(118): get_class(integer)
#2 /../w/extensions/DisplayTitle/includes/DisplayTitleHooks.php(78): DisplayTitleHooks::handleLink(Title, integer)
#3 [internal function]: DisplayTitleHooks::onHtmlPageLinkRendererBegin(MediaWiki\Linker\LinkRenderer, Title, integer, array, array, NULL)
#4 /../w/includes/Hooks.php(177): call_user_func_array(string, array)
#5 /../w/includes/Hooks.php(205): Hooks::callHook(string, string, array, NULL)
#6 /../w/includes/linker/LinkRenderer.php(181): Hooks::run(string, array)
#7 /../w/includes/linker/LinkRenderer.php(252): MediaWiki\Linker\LinkRenderer->runBeginHook(Title, integer, array, array, boolean)
#8 /../w/includes/linker/LinkRenderer.php(300): MediaWiki\Linker\LinkRenderer->makePreloadedLink(Title, integer, string, array, array)
#9 /../w/includes/linker/LinkRenderer.php(150): MediaWiki\Linker\LinkRenderer->makeKnownLink(Title, integer, array, array)
#10 /../w/includes/logging/PatrolLogFormatter.php(59): MediaWiki\Linker\LinkRenderer->makeLink(Title, integer, array, array)
#11 /../w/includes/logging/PatrolLogFormatter.php(34): PatrolLogFormatter->getMessageParameters()
#12 /../w/includes/logging/LogFormatter.php(464): PatrolLogFormatter->getMessageKey()
#13 /../w/includes/logging/LogFormatter.php(440): LogFormatter->getActionMessage()
#14 /../w/includes/logging/LogEventsList.php(388): LogFormatter->getActionText()
#15 /../w/includes/logging/LogPager.php(376): LogEventsList->logLine(stdClass)
#16 /../w/includes/pager/IndexPager.php(445): LogPager->formatRow(stdClass)
#17 /../w/includes/specials/SpecialLog.php(207): IndexPager->getBody()
#18 /../w/includes/specials/SpecialLog.php(109): SpecialLog->show(FormOptions, array)
#19 /../w/includes/specialpage/SpecialPage.php(522): SpecialLog->execute(string)
#20 /../w/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(string)
#21 /../w/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
#22 /../w/includes/MediaWiki.php(851): MediaWiki->performRequest()
#23 /../w/includes/MediaWiki.php(523): MediaWiki->main()
#24 /../w/index.php(43): MediaWiki->run()
#25 {main}

followed by

2017-11-29 19:37:06 phalaris 0210020150926-02100_: [580b136b2f65706e49f698a8] /w/index.php?hide_thanks_log=0&printable=yes&title=Sp%C3%A9cial:Journal/Oetterer   ErrorException from line 46 of /../w/includes/WebResponse.php: PHP Warning: Cannot modify header information - headers already sent by (output started at /../w/extensions/DisplayTitle/includes/DisplayTitleHooks.php:118)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /../w/includes/WebResponse.php(46): header(string, boolean)
#2 /../w/includes/OutputPage.php(2411): WebResponse->header(string)
#3 /../w/includes/MediaWiki.php(858): OutputPage->output(boolean)
#4 /../w/includes/MediaWiki.php(870): MediaWiki->{closure}()
#5 /../w/includes/MediaWiki.php(523): MediaWiki->main()
#6 /../w/index.php(43): MediaWiki->run()
#7 {main}

Event Timeline

Kghbln renamed this task from ErrorException from line 118 DisplayTitleHooks.php: PHP Warning: get_class() expects parameter 1 to be object, integer given to ErrorException from line 118 in DisplayTitleHooks.php: PHP Warning: get_class() expects parameter 1 to be object, integer given.Nov 29 2017, 7:54 PM

Change 394755 had a related patch set uploaded (by Cicalese; owner: Cindy Cicalese):
[mediawiki/extensions/DisplayTitle@master] Handle integers passed as link text

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

@Kghbln, please review https://gerrit.wikimedia.org/r/#/c/394755/ when you have a chance. If you could test on MW 1.29 and 1.30, that would be awesome. Thanks!

@CCicalese_WMF I have moved in patch-set 3 on sandbox.smw.o and things seem to be fine. This was really an issue flooding the error log. I looked back into the logs for MW 1.29 and did not get this error at all so this must have been some MW 1.30 thing. Currently I do not have any wiki using 1.29 at hand so I cannot test on this version.

Thank you, @Kghbln. Could you please +1 the patch from the perspective of MW 1.30RC0? I have somebody else confirming that it still works for MW 1.29. Thanks!

@CCicalese_WMF I just checked the error log to see if something may have slipped. However everything is ok!

I left another comment at the patch set since you are specifically focusing on MW 1.29 and MW 1.30 here.

The patch works for me, but I do wonder if actually there's a fix to be made to LinkRenderer::runBeginHook() as well, because it shouldn't be passing a non-string parameter like that (or its documentation should be updated). The actual problem seems like it might be Language::formatNum() which shouldn't be returning an integer. However, that's out of scope! :)

Change 394755 merged by jenkins-bot:
[mediawiki/extensions/DisplayTitle@master] Handle integers passed as link text

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

I merged this since it's good hardening, but whatever is passing in integers as link text should probably be fixed to pass in strings.

Kghbln closed this task as Resolved.EditedDec 7 2017, 12:25 PM
Kghbln assigned this task to cicalese.

Thanks for fixing! We still need the tag but closing as resolved should be fine now. :)

Thank you, all! I just tagged the release.