From: Aryeh Gregor Date: Sun, 21 Sep 2008 02:53:24 +0000 (+0000) Subject: Prohibit empty page titles at a low level X-Git-Tag: 1.31.0-rc.0~45189 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=913e0d45277f4993790dcfe8ea5efc614d798452;p=lhc%2Fweb%2Fwiklou.git 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. --- 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) ) {