jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/335395 )
Change subject: Replace use of &$this ...................................................................... Replace use of &$this Use of &$this doesn't work in PHP 7.1. For callbacks to methods like array_map() it's completely unnecessary, while for hooks we still need to pass a reference and so we need to copy $this into a local variable. Bug: T153505 Change-Id: Ie530fb0cd12a5939011558979e3798241e3ced62 --- M includes/PF_Template.php M specials/PF_UploadWindow.php 2 files changed, 12 insertions(+), 4 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/PF_Template.php b/includes/PF_Template.php index 936a30f..68c4bf2 100644 --- a/includes/PF_Template.php +++ b/includes/PF_Template.php @@ -361,7 +361,9 @@ * extension. */ public function createText() { - Hooks::run( 'PageForms::CreateTemplateText', array( &$this ) ); + // Avoid PHP 7.1 warning from passing $this by reference + $template = $this; + Hooks::run( 'PageForms::CreateTemplateText', array( &$template ) ); $templateHeader = wfMessage( 'pf_template_docu', $this->mTemplateName )->inContentLanguage()->text(); $text = <<<END <noinclude> diff --git a/specials/PF_UploadWindow.php b/specials/PF_UploadWindow.php index 82c0a10..c5a6d90 100644 --- a/specials/PF_UploadWindow.php +++ b/specials/PF_UploadWindow.php @@ -151,7 +151,9 @@ $this->processUpload(); } else { # Backwards compatibility hook - if( !Hooks::run( 'UploadForm:initial', array( &$this ) ) ) { + // Avoid PHP 7.1 warning from passing $this by reference + $page = $this; + if( !Hooks::run( 'UploadForm:initial', array( &$page ) ) ) { wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" ); return; } @@ -327,7 +329,9 @@ if ( !$status->isOK() ) return $this->showUploadForm( $this->getUploadForm( $this->getOutput()->parse( $status->getWikiText() ) ) ); - if( !Hooks::run( 'UploadForm:BeforeProcessing', array( &$this ) ) ) { + // Avoid PHP 7.1 warning from passing $this by reference + $page = $this; + if( !Hooks::run( 'UploadForm:BeforeProcessing', array( &$page ) ) ) { wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" ); // This code path is deprecated. If you want to break upload processing // do so by hooking into the appropriate hooks in UploadBase::verifyUpload @@ -428,7 +432,9 @@ print $output; $img = null; // @todo: added to avoid passing a ref to null - should this be defined somewhere? - Hooks::run( 'SpecialUploadComplete', array( &$this ) ); + // Avoid PHP 7.1 warning from passing $this by reference + $page = $this; + Hooks::run( 'SpecialUploadComplete', array( &$page ) ); } /** -- To view, visit https://gerrit.wikimedia.org/r/335395 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie530fb0cd12a5939011558979e3798241e3ced62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageForms Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Legoktm <lego...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits