MovePage: Don't try to pass non-strings into Title::newFromText

Bug: T104852
Change-Id: I240c0993977a8e7e584b93e95ace0907f7b7825c
This commit is contained in:
Alex Monk 2015-07-06 21:30:32 +01:00 committed by Timo Tijhof
parent 120ec6bb08
commit 11f5ebec28

View file

@ -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() ) {