jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399763 )

Change subject: Changed &$this in hooks
......................................................................


Changed &$this in hooks

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

Bug: T153505
Change-Id: Iead52dc11280173c0d9c9081194a086886986038
---
M NewUserNotif.class.php
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/NewUserNotif.class.php b/NewUserNotif.class.php
index 975af8c..4cfabe5 100644
--- a/NewUserNotif.class.php
+++ b/NewUserNotif.class.php
@@ -87,7 +87,9 @@
        private function makeSubject( $recipient, $user ) {
                global $wgSitename;
                $subjectLine = "";
-               Hooks::run( 'NewUserNotifSubject', array( &$this, 
&$subjectLine, $wgSitename, $recipient, $user ) );
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $userNotif = $this;
+               Hooks::run( 'NewUserNotifSubject', array( &$userNotif, 
&$subjectLine, $wgSitename, $recipient, $user ) );
                if (!strlen($subjectLine) )
                        return wfMessage( 'newusernotifsubj', $wgSitename 
)->inContentLanguage()->text();
                return $subjectLine;
@@ -102,7 +104,9 @@
        private function makeMessage( $recipient, $user ) {
                global $wgSitename, $wgContLang;
                $messageBody = "";
-               Hooks::run( 'NewUserNotifBody', array( &$this, &$messageBody, 
$wgSitename, $recipient, $user ) );
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $userNotif = $this;
+               Hooks::run( 'NewUserNotifBody', array( &$userNotif, 
&$messageBody, $wgSitename, $recipient, $user ) );
                if (!strlen($messageBody) )
                        return wfMessage(
                                'newusernotifbody',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iead52dc11280173c0d9c9081194a086886986038
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/NewUserNotif
Gerrit-Branch: master
Gerrit-Owner: Ryan10145 <chang.ryan10...@gmail.com>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Thiemo Kreuz (WMDE) <thiemo.kr...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to