isRedirect() assumes that the LinkCache already contains
information about this title. If that is not the case, it
currently returns false, even though it just doesn't know
whether this link is a redirect.
The new check asserts the assumption that this title
is already known to the link cache.
Amend: use Exception instead of assert()
Change-Id: Id3ad2d4e140b270b1f5ca1f7af9b3320cffff5a2
return $this->mRedirect = false;
}
$linkCache = LinkCache::singleton();
- $this->mRedirect = (bool)$linkCache->getGoodLinkFieldObj( $this, 'redirect' );
+ $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
+
+ if ( $cached === null ) { # check the assumption that the cache actually knows about this title
+ throw new MWException( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
+ }
+
+ $this->mRedirect = (bool)$cached;
return $this->mRedirect;
}