I get error "[XJjRqgpAAEAAABehZz8AAACS] 2019-03-25 13:03:38: Fatal exception of type "Error"" when trying to read my notifications.
Description
Details
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| Do not fail on unknown revids in mention-summary events | mediawiki/extensions/Echo | master | +2 -2 |
Related Objects
Event Timeline
Call to a member function getComment() on null
#0 /srv/mediawiki/php-1.33.0-wmf.22/extensions/Echo/includes/formatters/SpecialNotificationsFormatter.php(48): EchoMentionInSummaryPresentationModel->getBodyMessage()
#1 /srv/mediawiki/php-1.33.0-wmf.22/extensions/Echo/includes/formatters/EchoEventFormatter.php(72): SpecialNotificationsFormatter->formatModel(EchoMentionInSummaryPresentationModel)
#2 /srv/mediawiki/php-1.33.0-wmf.22/extensions/Echo/includes/DataOutputFormatter.php(187): EchoEventFormatter->format(EchoEvent)
#3 /srv/mediawiki/php-1.33.0-wmf.22/extensions/Echo/includes/DataOutputFormatter.php(147): EchoDataOutputFormatter::formatNotification(EchoEvent, User, string, LanguageEn)
#4 /srv/mediawiki/php-1.33.0-wmf.22/extensions/Echo/includes/special/SpecialNotifications.php(63): EchoDataOutputFormatter::formatOutput(EchoNotification, string, User, LanguageEn)
#5 /srv/mediawiki/php-1.33.0-wmf.22/includes/specialpage/SpecialPage.php(569): SpecialNotifications->execute(NULL)
#6 /srv/mediawiki/php-1.33.0-wmf.22/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(NULL)
#7 /srv/mediawiki/php-1.33.0-wmf.22/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#8 /srv/mediawiki/php-1.33.0-wmf.22/includes/MediaWiki.php(867): MediaWiki->performRequest()
#9 /srv/mediawiki/php-1.33.0-wmf.22/includes/MediaWiki.php(517): MediaWiki->main()
#10 /srv/mediawiki/php-1.33.0-wmf.22/index.php(42): MediaWiki->run()
#11 /srv/mediawiki/w/index.php(3): require(string)
#12 {main}Change 499558 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/extensions/Echo@master] Do not fail on unknown revids in mention-summary events
public function getBodyMessage() {
if ( $this->userCan( Revision::DELETED_COMMENT ) ) {
$revision = $this->event->getRevision();
$summary = $revision->getComment();
$summary = Linker::formatComment( $summary );
$summary = Sanitizer::stripAllTags( $summary );
$msg = $this->msg( 'notification-body-mention' )
->plaintextParams( $summary );
return $msg;
} else {
return false;
}
}EchoEvent::getRevision is documented to return null and the $revision->getComment() fails
it seems there is a mention-summary event without a (existing) 'revid'.
I would say this can only happen when Revision::newFromId does not find the provided revid due to deletion
The code above will render a notification with an empty body. If you want the notification to not be present at all in this case you can add your condition to the canRender() function of the presentation model.
Note that T204795 was similar in that it also involved creating notifications for an events where the rev-id data seemingly could not be resolved. I don't know if there is a common or central piece of code between the two that could prevent this, but just mentioning it :)
Yes, the event has a empty body, but the header described what was happen. It also linked to an invalid diff, because one revision is gone.
I want to fix the fatal first. I have no idea what the maintenancer of the extension would expect when a revision is missing.
When a page is deleted, the event is not showing, when undelete the event is shown, because it is associated with the pageid, but when on undelete a revision is missing, than this error is happen. One solution is to remove the event from the list. But what is with the count of unread events when it is not rendered? Maybe the mention is enough to look at the page what was happen to guess why mention and soit could stay. I have not looked how other events handled missing pages or revisions or users.
When it is expected to not render the event, feel free to upload a patch set.
Change 499558 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Do not fail on unknown revids in mention-summary events