From e22a3f516b5cfd7ac93419e17a14431bab138d03 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sat, 6 Apr 2019 01:34:56 +0100 Subject: [PATCH] specials: Remove invalid return from RedirectSpecialPage::execute Follows-up f739a8f368a, and 22c9aa5ec07. The execute() method here should generally be void, with the exception of includable special pages, where the return value is a string of HTML. This was likely left-over early iteration of commit f739a8f368a, which ended up returning from getRedirect() instead. Change-Id: I68715910114e19a0421625e814fd8881068f6406 --- RELEASE-NOTES-1.34 | 4 ++++ includes/specialpage/RedirectSpecialPage.php | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 83da30135c..219cba487c 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -89,6 +89,10 @@ because of Phabricator reports. * ObjectFactory class, deprecated in 1.31, has been removed. * HWLDFWordAccumudlator class, deprecated in 1.28, has been removed. * XMPInfo, XMPReader and XMPValidate, deprecated in 1.32, have been removed. +* The RedirectSpecialPage::execute method could sometimes return a Title object. + This behavior was removed, and the method now matches the parent signature + (SpecialPage::execute) which is to return HTML string or void. + To obtain the destination title, use RedirectSpecialPage::getRedirect. === Deprecations in 1.34 === * The MWNamespace class is deprecated. Use MediaWikiServices::getNamespaceInfo. diff --git a/includes/specialpage/RedirectSpecialPage.php b/includes/specialpage/RedirectSpecialPage.php index 01a88f4933..23a868e363 100644 --- a/includes/specialpage/RedirectSpecialPage.php +++ b/includes/specialpage/RedirectSpecialPage.php @@ -35,23 +35,19 @@ abstract class RedirectSpecialPage extends UnlistedSpecialPage { /** * @param string|null $subpage - * @return Title|bool */ public function execute( $subpage ) { $redirect = $this->getRedirect( $subpage ); $query = $this->getRedirectQuery(); - // Redirect to a page title with possible query parameters + if ( $redirect instanceof Title ) { + // Redirect to a page title with possible query parameters $url = $redirect->getFullUrlForRedirect( $query ); $this->getOutput()->redirect( $url ); - - return $redirect; } elseif ( $redirect === true ) { // Redirect to index.php with query parameters $url = wfAppendQuery( wfScript( 'index' ), $query ); $this->getOutput()->redirect( $url ); - - return $redirect; } else { $this->showNoRedirectPage(); } -- 2.20.1