jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/329138 )
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 --- 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(-) Approvals: MtDu: Looks good to me, but someone else must approve Florianschmidtwelzow: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 767a163..e8aec1c 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -428,7 +428,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 c1ad947..063d661 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1936,7 +1936,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 ); @@ -1984,7 +1987,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; } @@ -2002,7 +2007,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 160ce87..d42e306 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -174,7 +174,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/329138 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0862476a39a1c3206a84f79c1b8f7db41bc47959 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Victorbarbu <victorbarb...@gmail.com> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: MtDu <justin.d...@gmail.com> Gerrit-Reviewer: Victorbarbu <victorbarb...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits