From bc0405d52ff578338aa319c948011e973bfc57c2 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 27 Aug 2019 20:21:28 +0300 Subject: [PATCH] BadFileLookup::isBadFile() expects null, not false This deviation in behavior from wfIsBadImage() is accounted for in that function, but I didn't account for it when changing callers to use the service. Bug: T231340 Bug: T231353 Change-Id: Iddf177770fb1763ed295d694ed6bab441ea9ab73 --- includes/api/ApiQueryImageInfo.php | 2 +- includes/gallery/ImageGalleryBase.php | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index b97ab3c362..5e737c3c0e 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -63,7 +63,7 @@ class ApiQueryImageInfo extends ApiQueryBase { $this->dieWithError( [ 'apierror-bad-badfilecontexttitle', $p ], 'invalid-title' ); } } else { - $badFileContextTitle = false; + $badFileContextTitle = null; } $pageIds = $this->getPageSet()->getGoodAndMissingTitlesByNamespace(); diff --git a/includes/gallery/ImageGalleryBase.php b/includes/gallery/ImageGalleryBase.php index 06e12710b6..991ef79f87 100644 --- a/includes/gallery/ImageGalleryBase.php +++ b/includes/gallery/ImageGalleryBase.php @@ -80,10 +80,10 @@ abstract class ImageGalleryBase extends ContextSource { public $mParser; /** - * @var Title Contextual title, used when images are being screened against + * @var Title|null Contextual title, used when images are being screened against * the bad image list */ - protected $contextTitle = false; + protected $contextTitle = null; /** @var array */ protected $mAttribs = []; @@ -363,7 +363,7 @@ abstract class ImageGalleryBase extends ContextSource { /** * Set the contextual title * - * @param Title $title Contextual title + * @param Title|null $title Contextual title */ public function setContextTitle( $title ) { $this->contextTitle = $title; @@ -372,12 +372,10 @@ abstract class ImageGalleryBase extends ContextSource { /** * Get the contextual title, if applicable * - * @return Title|bool Title or false + * @return Title|null */ public function getContextTitle() { - return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title - ? $this->contextTitle - : false; + return $this->contextTitle; } /** -- 2.20.1