Merge "Add checks to try to catch T92046"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 2 Apr 2015 23:41:06 +0000 (23:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 2 Apr 2015 23:41:06 +0000 (23:41 +0000)
includes/Revision.php
includes/page/WikiPage.php

index a13499a..3ba6157 100644 (file)
@@ -1428,6 +1428,14 @@ class Revision implements IDBAccessObject {
 
                $this->mId = $rev_id !== null ? $rev_id : $dbw->insertId();
 
+               // Assertion to try to catch T92046
+               if ( (int)$this->mId === 0 ) {
+                       throw new UnexpectedValueException(
+                               'After insert, Revision mId is ' . var_export( $this->mId, 1 ) . ': ' .
+                                       var_export( $row, 1 )
+                       );
+               }
+
                Hooks::run( 'RevisionInsertComplete', array( &$this, $data, $flags ) );
 
                return $this->mId;
index d96e271..b435c5c 100644 (file)
@@ -1271,6 +1271,13 @@ class WikiPage implements Page, IDBAccessObject {
        ) {
                global $wgContentHandlerUseDB;
 
+               // Assertion to try to catch T92046
+               if ( (int)$revision->getId() === 0 ) {
+                       throw new InvalidArgumentException(
+                               __METHOD__ . ': Revision has ID ' . var_export( $revision->getId(), 1 )
+                       );
+               }
+
                $content = $revision->getContent();
                $len = $content ? $content->getSize() : 0;
                $rt = $content ? $content->getUltimateRedirectTarget() : null;