John Erling Blad has submitted this change and it was merged. Change subject: Prevent type errors on unexpected diff types in changes. ......................................................................
Prevent type errors on unexpected diff types in changes. Change-Id: I08ebd11da8b737900afb3f5a37b770ea725b8f4e --- M client/includes/ChangeHandler.php M lib/includes/changes/ItemChange.php 2 files changed, 4 insertions(+), 5 deletions(-) Approvals: John Erling Blad: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/client/includes/ChangeHandler.php b/client/includes/ChangeHandler.php index 4ad7741..30e980c 100644 --- a/client/includes/ChangeHandler.php +++ b/client/includes/ChangeHandler.php @@ -677,10 +677,9 @@ $actions = 0; if ( $change instanceof ItemChange ) { - /* @var ItemDiff $diff */ $diff = $change->getDiff(); - if ( !$diff->getSiteLinkDiff()->isEmpty() ) { + if ( $diff instanceof ItemDiff && !$diff->getSiteLinkDiff()->isEmpty() ) { //TODO: make it so we don't have to re-render // if only the site links changed (see bug 45534) $actions |= self::PARSER_PURGE_ACTION | self::WEB_PURGE_ACTION | self::LINKS_UPDATE_ACTION @@ -688,12 +687,12 @@ } if ( $this->dataTransclusionAllowed ) { - if ( !$diff->getClaimDiff()->isEmpty() ) { + if ( $diff instanceof EntityDiff && !$diff->getClaimDiff()->isEmpty() ) { $actions |= self::PARSER_PURGE_ACTION | self::WEB_PURGE_ACTION | self::LINKS_UPDATE_ACTION | self::RC_ENTRY_ACTION | self::HISTORY_ENTRY_ACTION; } - if ( !$diff->getLabelDiff()->isEmpty() ) { + if ( $diff instanceof EntityDiff && !$diff->getLabelDiff()->isEmpty() ) { $actions |= self::PARSER_PURGE_ACTION | self::WEB_PURGE_ACTION | self::LINKS_UPDATE_ACTION | self::RC_ENTRY_ACTION | self::HISTORY_ENTRY_ACTION; } diff --git a/lib/includes/changes/ItemChange.php b/lib/includes/changes/ItemChange.php index d3bf23a..eaefc93 100644 --- a/lib/includes/changes/ItemChange.php +++ b/lib/includes/changes/ItemChange.php @@ -46,7 +46,7 @@ return new \Diff\Diff(); } else { - return $this->getDiff()->getSiteLinkDiff(); + return $diff->getSiteLinkDiff(); } } } -- To view, visit https://gerrit.wikimedia.org/r/54479 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I08ebd11da8b737900afb3f5a37b770ea725b8f4e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: John Erling Blad <john.b...@wikimedia.de> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits