From a0c53e606883f0ab1c02b92a5e0bca02d5640c94 Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Sat, 8 Dec 2012 19:13:44 +0100 Subject: [PATCH] Fix check to see if element is there already. PHP docs disagree with reality when it comes to return type of offsetGet, so switching to offsetExists. Issue spotted by Brad Jorsch Change-Id: I4ce1651d4ed681ab55cf297090ee963b64584bbf --- includes/site/SiteArray.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/site/SiteArray.php b/includes/site/SiteArray.php index 141629e050..ad57ed37f5 100644 --- a/includes/site/SiteArray.php +++ b/includes/site/SiteArray.php @@ -86,12 +86,12 @@ class SiteArray extends GenericArrayObject implements SiteList { * @param mixed $index */ public function offsetUnset( $index ) { - /** - * @var Site $site - */ - $site = $this->offsetGet( $index ); + if ( $this->offsetExists( $index ) ) { + /** + * @var Site $site + */ + $site = $this->offsetGet( $index ); - if ( $site !== false ) { unset( $this->byGlobalId[$site->getGlobalId()] ); unset( $this->byInternalId[$site->getInternalId()] ); } -- 2.20.1