r112569 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112568‎ | r112569 | r112570 >
Date:02:55, 28 February 2012
Author:tstarling
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialMovepage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialMovepage.php
@@ -55,6 +55,13 @@
5656 $oldTitleText = $request->getVal( 'wpOldTitle', $target );
5757 $this->oldTitle = Title::newFromText( $oldTitleText );
5858
 59+ if( is_null( $this->oldTitle ) ) {
 60+ throw new ErrorPageError( 'notargettitle', 'notargettext' );
 61+ }
 62+ if( !$this->oldTitle->exists() ) {
 63+ throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
 64+ }
 65+
5966 $newTitleTextMain = $request->getText( 'wpNewTitleMain' );
6067 $newTitleTextNs = $request->getInt( 'wpNewTitleNs', $this->oldTitle->getNamespace() );
6168 // Backwards compatibility for forms submitting here from other sources
@@ -64,12 +71,6 @@
6572 ? Title::newFromText( $newTitleText_bc )
6673 : Title::makeTitleSafe( $newTitleTextNs, $newTitleTextMain );
6774
68 - if( is_null( $this->oldTitle ) ) {
69 - throw new ErrorPageError( 'notargettitle', 'notargettext' );
70 - }
71 - if( !$this->oldTitle->exists() ) {
72 - throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
73 - }
7475
7576 $user = $this->getUser();
7677

Follow-up revisions

RevisionCommit summaryAuthorDate
r112572MFT r112569: fix fatal error on [[Special:MovePage]]tstarling02:57, 28 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110209[Special:MovePage] Split new title input, fix bug 29454 (byteLimit), namespac...krinkle16:26, 28 January 2012

Status & tagging log