Page MenuHomePhabricator

Echo crashed with the watchlist-change notifications for deleted pages created in 1.35
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue:

You need MW 1.35 (Echo REL1_35), the variable $wgEchoWatchlistNotifications should be enabled, the Edit to watched page option in user preferences should be enabled too. Add a pacge to your watchlist and then delete the page using another user. When you open notifications you will see an error message like:

[251742581bf419b8b60ddc96] /Special:Notifications TypeError from line 567 of /var/www/mediawiki/w/extensions/Echo/includes/formatters/EventPresentationModel.php: Argument 1 passed to EchoEventPresentationModel::getTruncatedTitleText() must be an instance of Title, null given, called in /var/www/mediawiki/w/extensions/Echo/includes/formatters/WatchlistChangePresentationModel.php on line 31

Backtrace:

#0 /var/www/mediawiki/w/extensions/Echo/includes/formatters/WatchlistChangePresentationModel.php(31): EchoEventPresentationModel->getTruncatedTitleText()
#1 /var/www/mediawiki/w/extensions/Echo/includes/formatters/SpecialNotificationsFormatter.php(45): EchoWatchlistChangePresentationModel->getHeaderMessage()
#2 /var/www/mediawiki/w/extensions/Echo/includes/formatters/EchoEventFormatter.php(72): SpecialNotificationsFormatter->formatModel()
#3 /var/www/mediawiki/w/extensions/Echo/includes/DataOutputFormatter.php(189): EchoEventFormatter->format()
#4 /var/www/mediawiki/w/extensions/Echo/includes/DataOutputFormatter.php(149): EchoDataOutputFormatter::formatNotification()
#5 /var/www/mediawiki/w/extensions/Echo/includes/special/SpecialNotifications.php(61): EchoDataOutputFormatter::formatOutput()
#6 /var/www/mediawiki/w/includes/specialpage/SpecialPage.php(600): SpecialNotifications->execute()
#7 /var/www/mediawiki/w/includes/specialpage/SpecialPageFactory.php(640): SpecialPage->run()
#8 /var/www/mediawiki/w/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#9 /var/www/mediawiki/w/includes/MediaWiki.php(947): MediaWiki->performRequest()
#10 /var/www/mediawiki/w/includes/MediaWiki.php(547): MediaWiki->main()
#11 /var/www/mediawiki/w/index.php(53): MediaWiki->run()
#12 /var/www/mediawiki/w/index.php(46): wfIndexMain()
#13 {main}

This is because the Echo version for MW 1.35 (REL1_35) branch does not insert page_title and page_namespace to the extra parameter in the Event (see includes/EchoHooks.php#L635 ) and then the Event::getTitle() function returns null and in the most cases in the source code returned value from the function is used as a Title object without checking.

Event Timeline

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

Related to T286192, which doesn't seem to have been backported. I think there is a valid bug here that Echo should do something better than crashing when a notification points to an invalid page, even though 1.35 is now EOL.

Thanks, @Pppery. Actually, it is a duplicate because T286192 is not fixed yet fully. The master branch is crashed with the notifications were created before the patch applied to the source code.