From: Brian Wolff Date: Mon, 29 Feb 2016 23:31:48 +0000 (+0000) Subject: Revert "Add type hint against LinkTarget" X-Git-Tag: 1.31.0-rc.0~7785^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=74ac95c0ccdb3b971f57e74084363c86f3155456;p=lhc%2Fweb%2Fwiklou.git Revert "Add type hint against LinkTarget" Can cause fatal if your database has invalid titles stored in it (Title::makeTitleSafe is fed to $lb->addObj() without checking that the result is non-null) This reverts commit 0e5a1f8879b211b44416e3762bf2d76c28f3f569. Change-Id: I4174b2fdcc3d8e24ecf0bcc39cd0f0f2e8bfd6b2 --- diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 987aa718ee..8f334cc435 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -58,8 +58,12 @@ class LinkBatch { /** * @param LinkTarget $linkTarget */ - public function addObj( LinkTarget $linkTarget ) { - $this->add( $linkTarget->getNamespace(), $linkTarget->getDBkey() ); + public function addObj( $linkTarget ) { + if ( is_object( $linkTarget ) ) { + $this->add( $linkTarget->getNamespace(), $linkTarget->getDBkey() ); + } else { + wfDebug( "Warning: LinkBatch::addObj got invalid LinkTarget object\n" ); + } } /**