From: Alex Monk Date: Mon, 6 Jul 2015 20:30:32 +0000 (+0100) Subject: MovePage: Don't try to pass non-strings into Title::newFromText X-Git-Tag: 1.31.0-rc.0~10836^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=11f5ebec28;p=lhc%2Fweb%2Fwiklou.git MovePage: Don't try to pass non-strings into Title::newFromText Bug: T104852 Change-Id: I240c0993977a8e7e584b93e95ace0907f7b7825c --- diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index ae1fefea20..5682657a45 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -28,7 +28,7 @@ */ class MovePageForm extends UnlistedSpecialPage { /** @var Title */ - protected $oldTitle; + protected $oldTitle = null; /** @var Title */ protected $newTitle; @@ -75,9 +75,12 @@ class MovePageForm extends UnlistedSpecialPage { // Yes, the use of getVal() and getText() is wanted, see bug 20365 $oldTitleText = $request->getVal( 'wpOldTitle', $target ); - $this->oldTitle = Title::newFromText( $oldTitleText ); + if ( is_string( $oldTitleText ) ) { + $this->oldTitle = Title::newFromText( $oldTitleText ); + } - if ( is_null( $this->oldTitle ) ) { + if ( $this->oldTitle === null ) { + // Either oldTitle wasn't passed, or newFromText returned null throw new ErrorPageError( 'notargettitle', 'notargettext' ); } if ( !$this->oldTitle->exists() ) {