mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 07:34:22 +00:00
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
This commit is contained in:
parent
0677292659
commit
1c3dd4fb0d
|
@ -116,8 +116,10 @@ class MathLaTeXML extends MathMathML {
|
|||
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
|
||||
|
|
|
@ -521,8 +521,10 @@ class MathMathML extends MathRenderer {
|
|||
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 );
|
||||
|
|
|
@ -275,7 +275,9 @@ class MathTexvc extends MathRenderer {
|
|||
$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;
|
||||
|
|
Loading…
Reference in a new issue