Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Facebook/HttpClients/FacebookStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FacebookStream
/**
* @var array Response headers from the stream wrapper
*/
protected $responseHeaders;
protected $responseHeaders = [];

/**
* Make a new context stream reference instance
Expand All @@ -56,7 +56,7 @@ public function streamContextCreate(array $options)
/**
* The response headers from the stream wrapper
*
* @return array|null
* @return array
*/
public function getResponseHeaders()
{
Expand All @@ -73,7 +73,7 @@ public function getResponseHeaders()
public function fileGetContents($url)
{
$rawResponse = file_get_contents($url, false, $this->stream);
$this->responseHeaders = $http_response_header;
$this->responseHeaders = $http_response_header ?: [];

return $rawResponse;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Facebook/HttpClients/FacebookStreamHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function send($url, $method, $body, array $headers, $timeOut)
$rawBody = $this->facebookStream->fileGetContents($url);
$rawHeaders = $this->facebookStream->getResponseHeaders();

if ($rawBody === false || !$rawHeaders) {
if ($rawBody === false || empty($rawHeaders)) {
throw new FacebookSDKException('Stream returned an empty response', 660);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Facebook/Url/FacebookUrlManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function removeParamsFromUrl($url, array $paramsToFilter)
*/
public static function appendParamsToUrl($url, array $newParams = [])
{
if (!$newParams) {
if (empty($newParams)) {
return $url;
}

Expand Down