From: jeroendedauw Date: Sat, 8 Dec 2012 18:13:44 +0000 (+0100) Subject: Fix check to see if element is there already. X-Git-Tag: 1.31.0-rc.0~21351^2 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=a0c53e606883f0ab1c02b92a5e0bca02d5640c94;p=lhc%2Fweb%2Fwiklou.git 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 --- 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()] ); }