jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/328210 )

Change subject: ApiMove: Fix fatal when attempting to move to a namespace with 
no talkpages
......................................................................


ApiMove: Fix fatal when attempting to move to a namespace with no talkpages

The move will probably error out anyway, but we want it to do so
properly instead of by throwing a PHP fatal.

Bug: T153693
Change-Id: I19334a28a3f539e0f3d3866353093711f68786ee
---
M includes/api/ApiMove.php
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Gergő Tisza: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiMove.php b/includes/api/ApiMove.php
index 7c8aa90..18e582d 100644
--- a/includes/api/ApiMove.php
+++ b/includes/api/ApiMove.php
@@ -59,7 +59,7 @@
                if ( !$toTitle || $toTitle->isExternal() ) {
                        $this->dieWithError( [ 'apierror-invalidtitle', 
wfEscapeWikiText( $params['to'] ) ] );
                }
-               $toTalk = $toTitle->getTalkPage();
+               $toTalk = $toTitle->canTalk() ? $toTitle->getTalkPage() : null;
 
                if ( $toTitle->getNamespace() == NS_FILE
                        && !RepoGroup::singleton()->getLocalRepo()->findFile( 
$toTitle )
@@ -100,7 +100,7 @@
                $r['moveoverredirect'] = $toTitleExists;
 
                // Move the talk page
-               if ( $params['movetalk'] && $fromTalk->exists() && 
!$fromTitle->isTalkPage() ) {
+               if ( $params['movetalk'] && $toTalk && $fromTalk->exists() && 
!$fromTitle->isTalkPage() ) {
                        $toTalkExists = $toTalk->exists();
                        $status = $this->movePage( $fromTalk, $toTalk, 
$params['reason'], !$params['noredirect'] );
                        if ( $status->isOK() ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/328210
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I19334a28a3f539e0f3d3866353093711f68786ee
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to