Page MenuHomePhabricator

Fatal error ThanksHooks::onBeforePageDisplay
Closed, ResolvedPublic

Description

Fatal error: Call to a member function hasContentModel() on null in /www/dev.translatewiki.net/docroot/w/extensions/Thanks/Thanks.hooks.php on line 297

Code in question:

287         /**
288          * Handler for BeforePageDisplay.  Inserts javascript to enhance thank
289          * links from static urls to in-page dialogs along with reloading
290          * the previously thanked state.
291          *
292          * @param OutputPage $out OutputPage object
293          * @param Skin $skin
294          * @return bool
295          */
296         public static function onBeforePageDisplay( OutputPage $out, $skin ) {
297                 if ( $out->getTitle()->hasContentModel( 'flow-board' ) ) {
298                         $out->addModules( 'ext.thanks.flowthank' );
299                 }
300                 return true;
301         }

This happened while running runJobs.php manually (unfortunately not sure which job caused it) . Some context

2015-07-03 07:24:39 TTMServerMessageUpdateJob MediaWiki:wbqev-crosscheck-result-table-header-external-value (id=990875,timestamp=20150703072228) STARTING
2015-07-03 07:24:39 TTMServerMessageUpdateJob MediaWiki:wbqev-crosscheck-result-table-header-external-value (id=990875,timestamp=20150703072228) t=1 good
2015-07-03 07:24:39 MessageGroupStatesUpdaterJob Translations:Project:About/16/en (id=990213,timestamp=20150616173611) STARTING
2015-07-03 07:24:39 MessageGroupStatesUpdaterJob Translations:Project:About/16/en (id=990213,timestamp=20150616173611) t=4 good
2015-07-03 07:24:39 MessageGroupStatesUpdaterJob Translations:Project:About/20/en (id=990197,timestamp=20150616173600) STARTING
2015-07-03 07:24:39 MessageGroupStatesUpdaterJob Translations:Project:About/20/en (id=990197,timestamp=20150616173600) t=4 good
2015-07-03 07:24:39 TranslateRenderJob Project:About/ia user=FuzzyBot flags=16 summary=Updating to match new version of source page (id=989797,timestamp=20150616173435) STARTING
2015-07-03 07:24:40 TranslateRenderJob Project:About/ia user=FuzzyBot flags=16 summary=Updating to match new version of source page (id=989797,timestamp=20150616173435) t=1174 good

Fatal error: Call to a member function hasContentModel() on null in /www/dev.translatewiki.net/docroot/w/extensions/Thanks/Thanks.hooks.php on line 297

Event Timeline

Nikerabbit raised the priority of this task from to Needs Triage.
Nikerabbit updated the task description. (Show Details)
Nikerabbit added a project: Thanks.
Nikerabbit added a subscriber: Nikerabbit.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Not sure what job caused it (BeforePageDisplay shouldn't fire if there's no title), but we can easily work around it by not adding modules in that case.

Mattflaschen-WMF set Security to None.

Why is this unbreak now? Doesn't seem like an issue in Thanks, the BeforePageDisplay hook shouldn't be called from jobs...

Change 227975 had a related patch set uploaded (by Matthias Mullie):
Don't fatal when context doesn't know the title

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

Patch to treat the symptom (fatal error) is up.

Without knowing what job it was, it's hard to figure out why exactly it didn't know the Title.
But that hook only adds a module - I doubt that's useful/needed inside a job.

Change 227975 merged by jenkins-bot:
Don't fatal when context doesn't know the title

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

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