我正在使用 Hybridauth 社交登录,并且在用户使用 Facebook 进行身份验证时,我收到以下错误:
警告:array_key_exists() [function.array-key-exists]:第二个参数应该是第 1328 行 /hybridauth/Hybrid/thirdparty/Facebook/base_facebook.php 中的数组或对象
我对为什么会发生这种情况的猜测(可能是错误的)是因为用于传递给 Hybridauth 的参数来自浏览器 URL,并且我有两个 - page=register 和 connected_with=facebook。Hybridauth 只需要第二个...
它实际上进行了身份验证,但我想摆脱这个错误。为什么会出现此警告?有没有办法隐藏它?
这是错误的一点:
/**
* 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->getMetadataCookie();
if (array_key_exists('base_domain', $metadata) &&
!empty($metadata['base_domain'])) {
return trim($metadata['base_domain'], '.');
}
return $this->getHttpHost();
}
警告来自此代码:
/**
* Destroy the current session
*/
public function destroySession() {
$this->accessToken = null;
$this->signedRequest = null;
$this->user = null;
$this->clearAllPersistentData();
// JavaScript sets a cookie that will be used in getSignedRequest
// that we need to clear if we can
$cookie_name = $this->getSignedRequestCookieName();
if (array_key_exists($cookie_name, $_COOKIE)) {
unset($_COOKIE[$cookie_name]);
if (!headers_sent()) {
$base_domain = $this->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
}
}
}