diff --git a/lib/Doctrine/Common/Collections/ArrayCollection.php b/lib/Doctrine/Common/Collections/ArrayCollection.php index f4e6ce4f3..52ceef0a9 100644 --- a/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -120,7 +120,7 @@ public function current() */ public function remove($key) { - if (array_key_exists($key, $this->_elements)) { + if (isset($this->_elements[$key]) || array_key_exists($key, $this->_elements)) { $removed = $this->_elements[$key]; unset($this->_elements[$key]); @@ -214,7 +214,7 @@ public function offsetUnset($offset) */ public function containsKey($key) { - return array_key_exists($key, $this->_elements); + return isset($this->_elements[$key]) || array_key_exists($key, $this->_elements); } /**