From 74ac95c0ccdb3b971f57e74084363c86f3155456 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 29 Feb 2016 23:31:48 +0000 Subject: [PATCH] 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 --- includes/cache/LinkBatch.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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" ); + } } /** -- 2.20.1