Rafidaslam has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398673 )

Change subject: UserProfilePage: Avoid &$this in hooks
......................................................................

UserProfilePage: Avoid &$this in hooks

&$this triggers warnings in PHP 7.1. Simply renaming the variable before
passing it by reference avoids the warning, without breaking backwards
compatibility.

Bug: T153505
Change-Id: Ibb7308623437666f8b3afd2f8e8610f786883b20
---
M UserProfile/UserProfilePage.php
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile 
refs/changes/73/398673/1

diff --git a/UserProfile/UserProfilePage.php b/UserProfile/UserProfilePage.php
index 61e40fa..3e7fdcb 100644
--- a/UserProfile/UserProfilePage.php
+++ b/UserProfile/UserProfilePage.php
@@ -108,7 +108,10 @@
                // Left side
                $wgOut->addHTML( '<div id="user-page-left" class="clearfix">' );
 
-               if ( !Hooks::run( 'UserProfileBeginLeft', array( &$this ) ) ) {
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $userProfilePage = $this;
+
+               if ( !Hooks::run( 'UserProfileBeginLeft', array( 
&$userProfilePage ) ) ) {
                        wfDebug( __METHOD__ . ": UserProfileBeginLeft messed up 
profile!\n" );
                }
 
@@ -121,7 +124,7 @@
                $wgOut->addHTML( $this->getFanBoxes( $this->user_name ) );
                $wgOut->addHTML( $this->getUserStats( $this->user_id, 
$this->user_name ) );
 
-               if ( !Hooks::run( 'UserProfileEndLeft', array( &$this ) ) ) {
+               if ( !Hooks::run( 'UserProfileEndLeft', array( 
&$userProfilePage ) ) ) {
                        wfDebug( __METHOD__ . ": UserProfileEndLeft messed up 
profile!\n" );
                }
 
@@ -132,7 +135,7 @@
                // Right side
                $wgOut->addHTML( '<div id="user-page-right" class="clearfix">' 
);
 
-               if ( !Hooks::run( 'UserProfileBeginRight', array( &$this ) ) ) {
+               if ( !Hooks::run( 'UserProfileBeginRight', array( 
&$userProfilePage ) ) ) {
                        wfDebug( __METHOD__ . ": UserProfileBeginRight messed 
up profile!\n" );
                }
 
@@ -145,7 +148,7 @@
                $wgOut->addHTML( $this->getCasualGames( $this->user_id, 
$this->user_name ) );
                $wgOut->addHTML( $this->getUserBoard( $this->user_id, 
$this->user_name ) );
 
-               if ( !Hooks::run( 'UserProfileEndRight', array( &$this ) ) ) {
+               if ( !Hooks::run( 'UserProfileEndRight', array( 
&$userProfilePage ) ) ) {
                        wfDebug( __METHOD__ . ": UserProfileEndRight messed up 
profile!\n" );
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/398673
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb7308623437666f8b3afd2f8e8610f786883b20
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: Rafidaslam <rafidt...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to