Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MediaWikiのPHP 7.0以降対応用のtemporary patch
--- EditPage.php.ORG 2017-07-26 23:37:33.446933850 +0900
+++ EditPage.php 2017-07-27 07:15:49.483444502 +0900
@@ -2594,7 +2594,9 @@
$previewOutput = $this->getPreviewText();
}
- Hooks::run( 'EditPage::showEditForm:initial', [ &$this, &$wgOut ] );
+ // Avoid PHP 7.1 warning of passing $this by reference
+ $editPage = $this;
+ Hooks::run( 'EditPage::showEditForm:initial', [ &$editPage, &$wgOut ] );
$this->setHeaders();
@@ -2660,7 +2662,8 @@
. Xml::closeElement( 'div' )
);
- Hooks::run( 'EditPage::showEditForm:fields', [ &$this, &$wgOut ] );
+ $editPage = $this;
+ Hooks::run( 'EditPage::showEditForm:fields', [ &$editPage, &$wgOut ] );
// Put these up at the top to ensure they aren't lost on early form submission
$this->showFormBeforeText();
--- ./api/ApiBase.php.ORG 2017-07-29 11:15:27.062353895 +0900
+++ ./api/ApiBase.php 2017-07-29 11:16:14.849759147 +0900
@@ -2385,7 +2385,9 @@
] + ( isset( $params['token'] ) ? $params['token'] : [] );
}
- Hooks::run( 'APIGetAllowedParams', [ &$this, &$params, $flags ] );
+ // PHP 7.0
+ $api = $this;
+ Hooks::run( 'APIGetAllowedParams', [ &$api, &$params, $flags ] );
return $params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.