phpdoc @return MediaWikiTitleCodec in Title::getTitleParser
[lhc/web/wiklou.git] / includes / Revision.php
index 9373e40..f4f6dca 100644 (file)
@@ -1366,6 +1366,17 @@ class Revision implements IDBAccessObject {
        public function insertOn( $dbw ) {
                global $wgDefaultExternalStore, $wgContentHandlerUseDB;
 
+               // Not allowed to have rev_page equal to 0, false, etc.
+               if ( !$this->mPage ) {
+                       $title = $this->getTitle();
+                       if ( $title instanceof Title ) {
+                               $titleText = ' for page ' . $title->getPrefixedText();
+                       } else {
+                               $titleText = '';
+                       }
+                       throw new MWException( "Cannot insert revision$titleText: page ID must be nonzero" );
+               }
+
                $this->checkContentModel();
 
                $data = $this->mText;