ランダムな機会にこのエラーが発生します。
Fatal error: Uncaught CurlException: 3: No URL set!
thrown in /****/****/***/****/facebook/facebook-client/base_facebook.php on line 905
GIT リポジトリから最新の php sdk を使用しています (今日ダウンロードしました!)。これが発生したとき、ユーザーはすでに facebook にログインしています。
この動作は、2 週間前に突然始まりました。
何が間違っている可能性がありますか?
更新: ドメインに関連付けられているすべての Cookie を削除すると、問題は解決します。fbm_xxxxxxx と fbsr_xxxxxxxx の Cookie が正しく検出されないため、何かをしなければならないと思います。ただし、「ランダムな」機会に戻ってくる可能性があり、そのドメインに関連付けられているすべての Cookie をクリアする必要があります。
更新: このコードのチャンクでエラーが発生します:
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$isfb = null;
setcookie('fbm_'.$facebook->getAppId(), '', time()-100, '/', '.mydomain.com');
}
最終的に base_facebook.php でこの関数を呼び出します:
protected function makeRequest($url, $params, $ch=null) {
if (!$ch) {
$ch = curl_init();
}
$opts = self::$CURL_OPTS;
if ($this->getFileUploadSupport()) {
$opts[CURLOPT_POSTFIELDS] = $params;
} else {
$opts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&');
}
$opts[CURLOPT_URL] = $url;
// disable the 'Expect: 100-continue' behaviour. This causes CURL to wait
// for 2 seconds if the server does not support this header.
if (isset($opts[CURLOPT_HTTPHEADER])) {
$existing_headers = $opts[CURLOPT_HTTPHEADER];
$existing_headers[] = 'Expect:';
$opts[CURLOPT_HTTPHEADER] = $existing_headers;
} else {
$opts[CURLOPT_HTTPHEADER] = array('Expect:');
}
curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
if (curl_errno($ch) == 60) { // CURLE_SSL_CACERT
self::errorLog('Invalid or no certificate authority found, '.
'using bundled information');
curl_setopt($ch, CURLOPT_CAINFO,
dirname(__FILE__) . '/fb_ca_chain_bundle.crt');
$result = curl_exec($ch);
}
// With dual stacked DNS responses, it's possible for a server to
// have IPv6 enabled but not have IPv6 connectivity. If this is
// the case, curl will try IPv4 first and if that fails, then it will
// fall back to IPv6 and the error EHOSTUNREACH is returned by the
// operating system.
if ($result === false && empty($opts[CURLOPT_IPRESOLVE])) {
$matches = array();
$regex = '/Failed to connect to ([^:].*): Network is unreachable/';
if (preg_match($regex, curl_error($ch), $matches)) {
if (strlen(@inet_pton($matches[1])) === 16) {
self::errorLog('Invalid IPv6 configuration on server, '.
'Please disable or get native IPv6 on your server.');
self::$CURL_OPTS[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$result = curl_exec($ch);
}
}
}
if ($result === false) {
$e = new FacebookApiException(array(
'error_code' => curl_errno($ch),
'error' => array(
'message' => curl_error($ch)."\n".$opts[CURLOPT_POSTFIELDS]."<br/>".$opts[CURLOPT_URL]."\n",
'type' => 'CurlException',
),
));
curl_close($ch);
throw $e;
}
curl_close($ch);
return $result;
}
と をエコーする$opts[CURLOPT_POSTFIELDS]
と$opts[CURLOPT_URL]
、postfields と URL の両方が適切に設定されました。サーバーの問題である可能性はありますか?
更新: しばらく待ってからページを更新すると、すべてが正常に戻ります。