From 913e0d45277f4993790dcfe8ea5efc614d798452 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 21 Sep 2008 02:53:24 +0000 Subject: [PATCH] Prohibit empty page titles at a low level 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index b4cec3cc4e..9c382f663f 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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) ) { -- 2.20.1