From 7fe98fb56ccacafbb8a00347b6a3f7bb3168cf13 Mon Sep 17 00:00:00 2001 From: Matthias Mullie Date: Mon, 4 Nov 2019 11:12:19 +0100 Subject: [PATCH] Don't calculate amount of inbetween revisions for MCR undo Ib404d29a662de7736b50a1d07380f651d332ad6b introduced a new sanity check in RevisionStore::countRevisionsBetween to check whether the ids are not null (otherwise, they're considered unsaved) For MCR undo actions, diffs could be generated for unsaved revisions (where one revision is a not yet pre-existing combination where some slots remain unchanged, but some slot gets undone) The existing if statement here was already trying to guard against unsaved revisions, but was doing so in a way different from the new checks in RevisionStore::countRevisionsBetween - even though this was documented to only diff saved revisions, it wasn't checking thoroughly enough, and an exception would crop up later. Bug: T236320 Change-Id: If34766675f50b67d8b0788a6eab07d8d4e6fe183 --- includes/diff/DifferenceEngine.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index f5a4189d1a3..3e79dc626c1 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -1503,6 +1503,7 @@ class DifferenceEngine extends ContextSource { !$this->mOldRev || !$this->mNewRev || !$this->mOldPage || !$this->mNewPage || !$this->mOldPage->equals( $this->mNewPage ) + || $this->mOldRev->getId() === null || $this->mNewRev->getId() === null ) { return ''; }