Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403660 )

Change subject: Revision::newNullRevision don't pass null to RevisionStore
......................................................................

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
(cherry picked from commit 54f0872c7f8549745e10930dc99eb83444c62c21)
---
M includes/Revision.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/403660/1

diff --git a/includes/Revision.php b/includes/Revision.php
index 0844e89..b653f7f 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -1065,7 +1065,11 @@
 
                $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 );

-- 
To view, visit https://gerrit.wikimedia.org/r/403660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1f99d091ab9cd37d514a4f4cbf3c28b64426cb7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.31.0-wmf.16
Gerrit-Owner: Addshore <addshorew...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to