BadFileLookup::isBadFile() expects null, not false
authorAryeh Gregor <ayg@aryeh.name>
Tue, 27 Aug 2019 17:21:28 +0000 (20:21 +0300)
committerKrinkle <krinklemail@gmail.com>
Tue, 27 Aug 2019 17:50:36 +0000 (17:50 +0000)
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
includes/gallery/ImageGalleryBase.php

index b97ab3c..5e737c3 100644 (file)
@@ -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();
index 06e1271..991ef79 100644 (file)
@@ -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;
        }
 
        /**