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

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
---
M MathLaTeXML.php
M MathMathML.php
M MathTexvc.php
3 files changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/94/335394/1

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 d29210a..e1e6f06 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/335394
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib31f3bbffdd6b25ad9a21498294644e4dde33bd1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Anomie <bjor...@wikimedia.org>

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

Reply via email to