Martineznovo has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364761 )
Change subject: EditPage: Avoid use of &$this in hooks
......................................................................
EditPage: Avoid use of &$this in hooks
* This triggers warnings in PHP 7.1
Conflicts:
includes/EditPage.php
Bug: T153505
Change-Id: I5324a6bfe9e8ed255975104c5de7e7a7011cb741
---
M includes/EditPage.php
1 file changed, 20 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/61/364761/1
diff --git a/includes/EditPage.php b/includes/EditPage.php
index a563b27..caffbcf 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2594,7 +2594,9 @@
$previewOutput = $this->getPreviewText();
}
- Hooks::run( 'EditPage::showEditForm:initial', [ &$this, &$wgOut
] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ Hooks::run( 'EditPage::showEditForm:initial', [ &$editPage,
&$wgOut ] );
$this->setHeaders();
@@ -2660,7 +2662,9 @@
. Xml::closeElement( 'div' )
);
- Hooks::run( 'EditPage::showEditForm:fields', [ &$this, &$wgOut
] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ Hooks::run( 'EditPage::showEditForm:fields', [ &$editPage,
&$wgOut ] );
// Put these up at the top to ensure they aren't lost on early
form submission
$this->showFormBeforeText();
@@ -3641,7 +3645,9 @@
protected function showConflict() {
global $wgOut;
- if ( Hooks::run( 'EditPageBeforeConflictDiff', [ &$this,
&$wgOut ] ) ) {
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ if ( Hooks::run( 'EditPageBeforeConflictDiff', [ &$editPage,
&$wgOut ] ) ) {
$stats = $wgOut->getContext()->getStats();
$stats->increment( 'edit.failures.conflict' );
// Only include 'standard' namespaces to avoid creating
unknown numbers of statsd metrics
@@ -4169,7 +4175,10 @@
$checkboxes['watch'] = $watchThisHtml;
}
}
- Hooks::run( 'EditPageBeforeEditChecks', [ &$this, &$checkboxes,
&$tabindex ] );
+
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ Hooks::run( 'EditPageBeforeEditChecks', [ &$editPage,
&$checkboxes, &$tabindex ] );
return $checkboxes;
}
@@ -4219,7 +4228,9 @@
$buttons['diff'] = Html::submitButton( $this->context->msg(
'showdiff' )->text(),
$attribs );
- Hooks::run( 'EditPageBeforeEditButtons', [ &$this, &$buttons,
&$tabindex ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ Hooks::run( 'EditPageBeforeEditButtons', [ &$editPage,
&$buttons, &$tabindex ] );
return $buttons;
}
@@ -4233,7 +4244,10 @@
$wgOut->prepareErrorPage( $this->context->msg(
'nosuchsectiontitle' ) );
$res = $this->context->msg( 'nosuchsectiontext', $this->section
)->parseAsBlock();
- Hooks::run( 'EditPageNoSuchSection', [ &$this, &$res ] );
+
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ Hooks::run( 'EditPageNoSuchSection', [ &$editPage, &$res ] );
$wgOut->addHTML( $res );
$wgOut->returnToMain( false, $this->mTitle );
--
To view, visit https://gerrit.wikimedia.org/r/364761
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5324a6bfe9e8ed255975104c5de7e7a7011cb741
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_20
Gerrit-Owner: Martineznovo <[email protected]>
Gerrit-Reviewer: MtDu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits