Merge "Add `showThumbnails` option to slideshow galleries"
[lhc/web/wiklou.git] / includes / page / ImagePage.php
index af77868..b60b010 100644 (file)
@@ -69,6 +69,7 @@ class ImagePage extends Article {
                $this->fileLoaded = true;
 
                $this->displayImg = $img = false;
+
                Hooks::run( 'ImagePageFindFile', [ $this, &$img, &$this->displayImg ] );
                if ( !$img ) { // not set by hook?
                        $img = wfFindFile( $this->getTitle() );
@@ -215,7 +216,6 @@ class ImagePage extends Article {
                        'filepage', // always show the local local Filepage.css, bug 29277
                        'mediawiki.action.view.filepage', // Add MediaWiki styles for a file page
                ] );
-
        }
 
        /**
@@ -336,7 +336,10 @@ class ImagePage extends Article {
                        $filename = wfEscapeWikiText( $this->displayImg->getName() );
                        $linktext = $filename;
 
-                       Hooks::run( 'ImageOpenShowImageInlineBefore', [ &$this, &$out ] );
+                       // Use of &$this in hooks triggers warnings in PHP 7.1
+                       $imagePage = $this;
+
+                       Hooks::run( 'ImageOpenShowImageInlineBefore', [ &$imagePage, &$out ] );
 
                        if ( $this->displayImg->allowInlineDisplay() ) {
                                # image