Reedy has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374092 )
Change subject: Replace some usages of &$this in hook parameters ...................................................................... Replace some usages of &$this in hook parameters Affected classes: - ApiBase - ApiPageSet - HistoryPager - RawAction Bug: T153505 Change-Id: I0862476a39a1c3206a84f79c1b8f7db41bc47959 (cherry picked from commit 8935fb4f6642b16481265aa8d7e345d317e85aa8) --- M includes/actions/HistoryAction.php M includes/actions/RawAction.php M includes/api/ApiBase.php M includes/api/ApiPageSet.php 4 files changed, 22 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/92/374092/1 diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 5ec10e6..60220ae 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -420,7 +420,10 @@ $queryInfo['options'], $this->tagFilter ); - Hooks::run( 'PageHistoryPager::getQueryInfo', [ &$this, &$queryInfo ] ); + + // Avoid PHP 7.1 warning of passing $this by reference + $historyPager = $this; + Hooks::run( 'PageHistoryPager::getQueryInfo', [ &$historyPager, &$queryInfo ] ); return $queryInfo; } diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 5bf24f6..d8c8bc3 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -108,7 +108,9 @@ $response->statusHeader( 404 ); } - if ( !Hooks::run( 'RawPageViewBeforeOutput', [ &$this, &$text ] ) ) { + // Avoid PHP 7.1 warning of passing $this by reference + $rawAction = $this; + if ( !Hooks::run( 'RawPageViewBeforeOutput', [ &$rawAction, &$text ] ) ) { wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" ); } diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 7172e4d..1ef70e2 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -2271,7 +2271,10 @@ */ public function getFinalDescription() { $desc = $this->getDescription(); - Hooks::run( 'APIGetDescription', [ &$this, &$desc ] ); + + // Avoid PHP 7.1 warning of passing $this by reference + $apiModule = $this; + Hooks::run( 'APIGetDescription', [ &$apiModule, &$desc ] ); $desc = self::escapeWikiText( $desc ); if ( is_array( $desc ) ) { $desc = implode( "\n", $desc ); @@ -2320,7 +2323,9 @@ ] + ( isset( $params['token'] ) ? $params['token'] : [] ); } - Hooks::run( 'APIGetAllowedParams', [ &$this, &$params, $flags ] ); + // Avoid PHP 7.1 warning of passing $this by reference + $apiModule = $this; + Hooks::run( 'APIGetAllowedParams', [ &$apiModule, &$params, $flags ] ); return $params; } @@ -2338,7 +2343,10 @@ $path = $this->getModulePath(); $desc = $this->getParamDescription(); - Hooks::run( 'APIGetParamDescription', [ &$this, &$desc ] ); + + // Avoid PHP 7.1 warning of passing $this by reference + $apiModule = $this; + Hooks::run( 'APIGetParamDescription', [ &$apiModule, &$desc ] ); if ( !$desc ) { $desc = []; diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index af4e536..7834669 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -173,7 +173,10 @@ // populate this pageset with the generator output if ( !$isDryRun ) { $generator->executeGenerator( $this ); - Hooks::run( 'APIQueryGeneratorAfterExecute', [ &$generator, &$this ] ); + + // Avoid PHP 7.1 warning of passing $this by reference + $apiModule = $this; + Hooks::run( 'APIQueryGeneratorAfterExecute', [ &$generator, &$apiModule ] ); } else { // Prevent warnings from being reported on these parameters $main = $this->getMain(); -- To view, visit https://gerrit.wikimedia.org/r/374092 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0862476a39a1c3206a84f79c1b8f7db41bc47959 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: REL1_27 Gerrit-Owner: Reedy <re...@wikimedia.org> Gerrit-Reviewer: Victorbarbu <victorbarb...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits