From 54f0872c7f8549745e10930dc99eb83444c62c21 Mon Sep 17 00:00:00 2001 From: addshore Date: Thu, 11 Jan 2018 09:22:16 +0000 Subject: [PATCH] Revision::newNullRevision don't pass null to RevisionStore RevisionStore::newNullRevision must be passed a Title object when being used, passing null will result in a fatal. Title::newFromID can return null, so check and return null early if we have no Title object. Also use Title::GAID_FOR_UPDATE for a higher chance of getting a Title. Prior to the Revision overhaul newNullRevision would have always done a select from master, it is documented as accepting $dbw and also passed FOR UPDATE as an option to selectRow. Bug: T184687 Change-Id: If1f99d091ab9cd37d514a4f4cbf3c28b64426cb7 --- includes/Revision.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/Revision.php b/includes/Revision.php index 0844e89286..b653f7f844 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1065,7 +1065,11 @@ class Revision implements IDBAccessObject { $comment = CommentStoreComment::newUnsavedComment( $summary, null ); - $title = Title::newFromID( $pageId ); + $title = Title::newFromID( $pageId, Title::GAID_FOR_UPDATE ); + if ( $title === null ) { + return null; + } + $rec = self::getRevisionStore()->newNullRevision( $dbw, $title, $comment, $minor, $user ); return new Revision( $rec ); -- 2.20.1