X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FRevision.php;h=431be69dc158b6066c2ca0282e72074816286b62;hb=95a4edf10a4a8bcdf3af8e786cf54a5c78d9ee59;hp=984da69206067f1a18bb087701ef1730b6a1f3fe;hpb=e8b571fbf1a41ac2a2000b2a515393494d93a806;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Revision.php b/includes/Revision.php index 984da69206..431be69dc1 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -600,15 +600,18 @@ class Revision implements IDBAccessObject { $this->mContent = $handler->unserializeContent( $this->mText ); } - // if we have a Title object, override mPage. Useful for testing and convenience. - if ( isset( $row['title'] ) ) { - $this->mTitle = $row['title']; - $this->mPage = $this->mTitle->getArticleID(); - } else { - $this->mTitle = null; // Load on demand if needed + // If we have a Title object, make sure it is consistent with mPage. + if ( $this->mTitle && $this->mTitle->exists() ) { + if ( $this->mPage === null ) { + // if the page ID wasn't known, set it now + $this->mPage = $this->mTitle->getArticleID(); + } elseif ( $this->mTitle->getArticleID() !== $this->mPage ) { + // got different page IDs, something is wrong. + throw new MWException( "Page ID " . $this->mPage . " mismatches the ID " + . $this->mTitle->getArticleID() . " provided by the Title object." ); + } } - // @todo: XXX: really? we are about to create a revision. it will usually then be the current one. $this->mCurrent = false; // If we still have no length, see it we have the text to figure it out