title: How can I solve the warning "Warning: array_key_exists."?
body: <p>I'm using Hybridauth social login, and upon a user authenticating with Facebook, I receive the following error:</p>
  
  <blockquote>
    <p>Warning: array_key_exists() [function.array-key-exists]: The second
    argument should be either an array or an object in
    /hybridauth/Hybrid/thirdparty/Facebook/base_facebook.php on line 1328</p>
  </blockquote>
  
  <p>My guess (probably wrong) to why this may be happening is because the parameters used to pass to Hybridauth come from the browser URL, and I have two - page=register &amp; connected_with=facebook. Hybridauth only requires the second one...</p>
  
  <p>It actually authenticates, but I want rid of this error. Why does this warning occur? Is there a way to hide it?</p>
  
  <p>This is the bit that errors:</p>
  
  <pre><code> /**
     * Get the base domain used for the cookie.
     */
    protected function getBaseDomain() {
      // The base domain is stored in the metadata cookie  
      // if not we fallback to the current hostname
      $metadata = $this-&gt;getMetadataCookie();
      if (array_key_exists('base_domain', $metadata) &amp;&amp;
          !empty($metadata['base_domain'])) {
        return trim($metadata['base_domain'], '.');
      }
      return $this-&gt;getHttpHost();
    }
  </code></pre>
  
  <p>It's this code the warning comes from:</p>
  
  <pre><code>  /**
     * Destroy the current session
     */
    public function destroySession() {
      $this-&gt;accessToken = null;
      $this-&gt;signedRequest = null;
      $this-&gt;user = null;
      $this-&gt;clearAllPersistentData();
  
      // JavaScript sets a cookie that will be used in getSignedRequest 
      // that we need to clear if we can
      $cookie_name = $this-&gt;getSignedRequestCookieName();
      if (array_key_exists($cookie_name, $_COOKIE)) {
        unset($_COOKIE[$cookie_name]);
        if (!headers_sent()) {
          $base_domain = $this-&gt;getBaseDomain();
          setcookie($cookie_name, '', 1, '/', '.'.$base_domain);
        } else {
          // @codeCoverageIgnoreStart
          self::errorLog(
            'There exists a cookie that we wanted to clear that we couldn\'t '.
            'clear because headers was already sent. Make sure to do the first '.
            'API call before outputting anything.'
          );
          // @codeCoverageIgnoreEnd
        }
      }
    }
  </code></pre>