Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Created July 29, 2017 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandanote-info/6cfb588bffa0e2a62aaff3246449ff3f to your computer and use it in GitHub Desktop.
Save pandanote-info/6cfb588bffa0e2a62aaff3246449ff3f to your computer and use it in GitHub Desktop.
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