From: Tim Starling Date: Tue, 28 Feb 2012 02:55:36 +0000 (+0000) Subject: Fix r110209: Move the invalid title check above the first use of the title object... X-Git-Tag: 1.31.0-rc.0~24472 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=85bbebc039212ce4db620afc18ae267457c0f7d4;p=lhc%2Fweb%2Fwiklou.git Fix r110209: Move the invalid title check above the first use of the title object, to avoid a fatal error, for example when navigating to [[Special:MovePage]] with no target. --- diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 56217b30f1..af498152e6 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -55,6 +55,13 @@ class MovePageForm extends UnlistedSpecialPage { $oldTitleText = $request->getVal( 'wpOldTitle', $target ); $this->oldTitle = Title::newFromText( $oldTitleText ); + if( is_null( $this->oldTitle ) ) { + throw new ErrorPageError( 'notargettitle', 'notargettext' ); + } + if( !$this->oldTitle->exists() ) { + throw new ErrorPageError( 'nopagetitle', 'nopagetext' ); + } + $newTitleTextMain = $request->getText( 'wpNewTitleMain' ); $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle->getNamespace() ); // Backwards compatibility for forms submitting here from other sources @@ -64,12 +71,6 @@ class MovePageForm extends UnlistedSpecialPage { ? Title::newFromText( $newTitleText_bc ) : Title::makeTitleSafe( $newTitleTextNs, $newTitleTextMain ); - if( is_null( $this->oldTitle ) ) { - throw new ErrorPageError( 'notargettitle', 'notargettext' ); - } - if( !$this->oldTitle->exists() ) { - throw new ErrorPageError( 'nopagetitle', 'nopagetext' ); - } $user = $this->getUser();