From 85bbebc039212ce4db620afc18ae267457c0f7d4 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 28 Feb 2012 02:55:36 +0000 Subject: [PATCH] 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. --- includes/specials/SpecialMovepage.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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(); -- 2.20.1