Prohibit empty page titles at a low level
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 21 Sep 2008 02:53:24 +0000 (02:53 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 21 Sep 2008 02:53:24 +0000 (02:53 +0000)
This adds a sanity check to EditPage::doEdit() that throws an exception if the Title's name (sans namespace) is empty.  Apparently the API edit module doesn't handle this error correctly at a high level, as evidenced by page 19405691 on enwiki.  I didn't try to test whether this extra check stops the particular error, but it doesn't hurt in any case.

includes/Article.php

index b4cec3c..9c382f6 100644 (file)
@@ -1415,11 +1415,16 @@ class Article {
        function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) {
                global $wgUser, $wgDBtransactions, $wgUseAutomaticEditSummaries;
 
-               if ($user == null) {
-                       $user = $wgUser;
+               # Low-level sanity check
+               if( $this->mTitle->getText() == '' ) {
+                       throw new MWException( 'Something is trying to edit an article with an empty title' );
                }
 
                wfProfileIn( __METHOD__ );
+
+               if ($user == null) {
+                       $user = $wgUser;
+               }
                $good = true;
 
                if ( !($flags & EDIT_NEW) && !($flags & EDIT_UPDATE) ) {