Replace use of &$this
[lhc/web/wiklou.git] / includes / skins / BaseTemplate.php
index 65eb9b7..eef421c 100644 (file)
@@ -112,7 +112,9 @@ abstract class BaseTemplate extends QuickTemplate {
                        $toolbox['info']['id'] = 't-info';
                }
 
-               Hooks::run( 'BaseTemplateToolbox', [ &$this, &$toolbox ] );
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $template = $this;
+               Hooks::run( 'BaseTemplateToolbox', [ &$template, &$toolbox ] );
                return $toolbox;
        }
 
@@ -227,7 +229,9 @@ abstract class BaseTemplate extends QuickTemplate {
                        ob_start();
                        // We pass an extra 'true' at the end so extensions using BaseTemplateToolbox
                        // can abort and avoid outputting double toolbox links
-                       Hooks::run( 'SkinTemplateToolboxEnd', [ &$this, true ] );
+                       // Avoid PHP 7.1 warning from passing $this by reference
+                       $template = $this;
+                       Hooks::run( 'SkinTemplateToolboxEnd', [ &$template, true ] );
                        $hookContents = ob_get_contents();
                        ob_end_clean();
                        if ( !trim( $hookContents ) ) {