Reedy has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/350563 )
Change subject: Work around &$this usage in SkinTemplate
......................................................................
Work around &$this usage in SkinTemplate
Using &$this triggers warnings with PHP 7.1.
Bug: T153505
Change-Id: I7798b08a356c64796c9aea1273eef88f8678f8d4
(cherry picked from commit a4f2d36cd049a1143502d0e50d8e655a34b6427c)
---
M includes/skins/SkinTemplate.php
1 file changed, 21 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/63/350563/1
diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index 6439749..daf4e10 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -485,8 +485,10 @@
$tpl->set( 'debughtml', $this->generateDebugHTML() );
$tpl->set( 'reporttime', wfReportTime() );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
// original version by hansm
- if ( !Hooks::run( 'SkinTemplateOutputPageBeforeExec', [ &$this,
&$tpl ] ) ) {
+ if ( !Hooks::run( 'SkinTemplateOutputPageBeforeExec', [
&$skinTemplate, &$tpl ] ) ) {
wfDebug( __METHOD__ . ": Hook
SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
}
@@ -747,8 +749,10 @@
MWNamespace::getSubject( $title->getNamespace()
) );
}
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
$result = [];
- if ( !Hooks::run( 'SkinTemplateTabAction', [ &$this,
+ if ( !Hooks::run( 'SkinTemplateTabAction', [ &$skinTemplate,
$title, $message, $selected, $checkEdit,
&$classes, &$query, &$text, &$result ] ) ) {
return $result;
@@ -844,8 +848,10 @@
$userCanRead = $title->quickUserCan( 'read', $user );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
$preventActiveTabs = false;
- Hooks::run( 'SkinTemplatePreventOtherActiveTabs', [ &$this,
&$preventActiveTabs ] );
+ Hooks::run( 'SkinTemplatePreventOtherActiveTabs', [
&$skinTemplate, &$preventActiveTabs ] );
// Checks if page is some kind of content
if ( $title->canExist() ) {
@@ -1048,7 +1054,9 @@
}
}
- Hooks::run( 'SkinTemplateNavigation', [ &$this,
&$content_navigation ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
+ Hooks::run( 'SkinTemplateNavigation', [ &$skinTemplate,
&$content_navigation ] );
if ( $userCanRead && !$wgDisableLangConversion ) {
$pageLang = $title->getPageLanguage();
@@ -1090,12 +1098,16 @@
'context' => 'subject'
];
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
Hooks::run( 'SkinTemplateNavigation::SpecialPage',
- [ &$this, &$content_navigation ] );
+ [ &$skinTemplate, &$content_navigation ] );
}
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
// Equiv to SkinTemplateContentActions
- Hooks::run( 'SkinTemplateNavigation::Universal', [ &$this,
&$content_navigation ] );
+ Hooks::run( 'SkinTemplateNavigation::Universal', [
&$skinTemplate, &$content_navigation ] );
// Setup xml ids and tooltip info
foreach ( $content_navigation as $section => &$links ) {
@@ -1229,9 +1241,11 @@
];
}
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $skinTemplate = $this;
// Use the copy of revision ID in case this
undocumented, shady hook tries to mess with internals
Hooks::run(
'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink',
- [ &$this, &$nav_urls, &$revid, &$revid ] );
+ [ &$skinTemplate, &$nav_urls, &$revid, &$revid
] );
}
if ( $out->isArticleRelated() ) {
--
To view, visit https://gerrit.wikimedia.org/r/350563
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7798b08a356c64796c9aea1273eef88f8678f8d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_27
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Sn1per <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits