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

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: Ib31f3bbffdd6b25ad9a21498294644e4dde33bd1
(cherry picked from commit 1c3dd4fb0dc982de7c6cdbd56f24905c8fa82af5)
---
M MathLaTeXML.php
M MathMathML.php
M MathTexvc.php
3 files changed, 9 insertions(+), 3 deletions(-)

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



diff --git a/MathLaTeXML.php b/MathLaTeXML.php
index 765342e..d5ae368 100644
--- a/MathLaTeXML.php
+++ b/MathLaTeXML.php
@@ -116,8 +116,10 @@
                        if ( $jsonResult && json_last_error() === 
JSON_ERROR_NONE ) {
                                if ( $this->isValidMathML( $jsonResult->result 
) ) {
                                        $this->setMathml( $jsonResult->result );
+                                       // Avoid PHP 7.1 warning from passing 
$this by reference
+                                       $renderer = $this;
                                        Hooks::run( 
'MathRenderingResultRetrieved',
-                                               [ &$this, &$jsonResult ] );// 
Enables debugging of server results
+                                               [ &$renderer, &$jsonResult ] 
);// Enables debugging of server results
                                        return true;
                                } else {
                                        // Do not print bad mathml. It's 
probably too verbose and might
diff --git a/MathMathML.php b/MathMathML.php
index 40bc77c..05cd825 100644
--- a/MathMathML.php
+++ b/MathMathML.php
@@ -521,8 +521,10 @@
                        if ( $this->getMode() != 'latexml' && $this->inputType 
!= 'pmml' ) {
                                $this->setMathml( $jsonResult->mml );
                        }
+                       // Avoid PHP 7.1 warning from passing $this by reference
+                       $renderer = $this;
                        Hooks::run( 'MathRenderingResultRetrieved',
-                               [ &$this, &$jsonResult ] ); // Enables 
debugging of server results
+                               [ &$renderer, &$jsonResult ] ); // Enables 
debugging of server results
                        return true;
                } else {
                        $this->lastError = $this->getError( 
'math_unknown_error', $host );
diff --git a/MathTexvc.php b/MathTexvc.php
index 7e130f9..88c8610 100644
--- a/MathTexvc.php
+++ b/MathTexvc.php
@@ -275,7 +275,9 @@
                        $this->setHash( $newHash );
                }
 
-               Hooks::run( 'MathAfterTexvc', [ &$this, &$errmsg ] );
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $renderer = $this;
+               Hooks::run( 'MathAfterTexvc', [ &$renderer, &$errmsg ] );
 
                if ( $errmsg ) {
                        return $errmsg;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib31f3bbffdd6b25ad9a21498294644e4dde33bd1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: REL1_28
Gerrit-Owner: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: TheDJ <hartman.w...@gmail.com>
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