From 4b8a9a5189a625bf99fedec7fd31f6e146410a14 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 26 Apr 2018 01:00:12 +0200 Subject: Update FB API library --- .../src/Facebook/Authentication/AccessToken.php | 2 +- .../Authentication/AccessTokenMetadata.php | 4 +- .../src/Facebook/Authentication/OAuth2Client.php | 10 +- .../Exceptions/FacebookAuthenticationException.php | 2 +- .../Exceptions/FacebookAuthorizationException.php | 2 +- .../Exceptions/FacebookClientException.php | 2 +- .../Facebook/Exceptions/FacebookOtherException.php | 2 +- .../Exceptions/FacebookResponseException.php | 14 +- .../FacebookResumableUploadException.php | 33 ++++ .../Facebook/Exceptions/FacebookSDKException.php | 2 +- .../Exceptions/FacebookServerException.php | 2 +- .../Exceptions/FacebookThrottleException.php | 2 +- lib/facebook-graph-sdk/src/Facebook/Facebook.php | 206 +++++++++++++-------- .../src/Facebook/FacebookApp.php | 17 +- .../src/Facebook/FacebookBatchRequest.php | 69 ++++--- .../src/Facebook/FacebookBatchResponse.php | 24 ++- .../src/Facebook/FacebookClient.php | 6 +- .../src/Facebook/FacebookRequest.php | 10 +- .../src/Facebook/FacebookResponse.php | 14 +- .../src/Facebook/FileUpload/FacebookFile.php | 40 +++- .../FileUpload/FacebookResumableUploader.php | 167 +++++++++++++++++ .../Facebook/FileUpload/FacebookTransferChunk.php | 133 +++++++++++++ .../src/Facebook/FileUpload/FacebookVideo.php | 2 +- .../src/Facebook/FileUpload/Mimetypes.php | 3 +- .../src/Facebook/GraphNodes/Birthday.php | 85 +++++++++ .../src/Facebook/GraphNodes/Collection.php | 4 +- .../src/Facebook/GraphNodes/GraphAchievement.php | 5 +- .../src/Facebook/GraphNodes/GraphAlbum.php | 2 +- .../src/Facebook/GraphNodes/GraphApplication.php | 2 +- .../src/Facebook/GraphNodes/GraphCoverPhoto.php | 2 +- .../src/Facebook/GraphNodes/GraphEdge.php | 44 ++--- .../src/Facebook/GraphNodes/GraphEvent.php | 2 +- .../src/Facebook/GraphNodes/GraphGroup.php | 3 +- .../src/Facebook/GraphNodes/GraphList.php | 2 +- .../src/Facebook/GraphNodes/GraphLocation.php | 2 +- .../src/Facebook/GraphNodes/GraphNode.php | 18 +- .../src/Facebook/GraphNodes/GraphNodeFactory.php | 4 +- .../src/Facebook/GraphNodes/GraphObject.php | 2 +- .../src/Facebook/GraphNodes/GraphObjectFactory.php | 8 +- .../src/Facebook/GraphNodes/GraphPage.php | 24 ++- .../src/Facebook/GraphNodes/GraphPicture.php | 2 +- .../src/Facebook/GraphNodes/GraphSessionInfo.php | 2 +- .../src/Facebook/GraphNodes/GraphUser.php | 14 +- .../src/Facebook/Helpers/FacebookCanvasHelper.php | 2 +- .../Facebook/Helpers/FacebookJavaScriptHelper.php | 2 +- .../src/Facebook/Helpers/FacebookPageTabHelper.php | 2 +- .../Helpers/FacebookRedirectLoginHelper.php | 81 +++----- .../FacebookSignedRequestFromInputHelper.php | 2 +- .../src/Facebook/Http/GraphRawResponse.php | 4 +- .../src/Facebook/Http/RequestBodyInterface.php | 2 +- .../src/Facebook/Http/RequestBodyMultipart.php | 2 +- .../src/Facebook/Http/RequestBodyUrlEncoded.php | 2 +- .../src/Facebook/HttpClients/FacebookCurl.php | 2 +- .../HttpClients/FacebookCurlHttpClient.php | 57 +----- .../HttpClients/FacebookGuzzleHttpClient.php | 2 +- .../HttpClients/FacebookHttpClientInterface.php | 2 +- .../src/Facebook/HttpClients/FacebookStream.php | 8 +- .../HttpClients/FacebookStreamHttpClient.php | 4 +- .../Facebook/HttpClients/HttpClientsFactory.php | 99 ++++++++++ .../FacebookMemoryPersistentDataHandler.php | 2 +- .../FacebookSessionPersistentDataHandler.php | 2 +- .../PersistentData/PersistentDataFactory.php | 65 +++++++ .../PersistentData/PersistentDataInterface.php | 2 +- .../McryptPseudoRandomStringGenerator.php | 2 +- .../OpenSslPseudoRandomStringGenerator.php | 2 +- .../PseudoRandomStringGeneratorFactory.php | 101 ++++++++++ .../PseudoRandomStringGeneratorInterface.php | 2 +- .../PseudoRandomStringGeneratorTrait.php | 4 +- .../RandomBytesPseudoRandomStringGenerator.php | 59 ++++++ .../UrandomPseudoRandomStringGenerator.php | 2 +- .../src/Facebook/SignedRequest.php | 18 +- .../Facebook/Url/FacebookUrlDetectionHandler.php | 25 ++- .../src/Facebook/Url/FacebookUrlManipulator.php | 4 +- .../src/Facebook/Url/UrlDetectionInterface.php | 2 +- lib/facebook-graph-sdk/src/Facebook/autoload.php | 4 +- lib/facebook-graph-sdk/src/Facebook/polyfills.php | 49 +++++ 76 files changed, 1258 insertions(+), 355 deletions(-) create mode 100644 lib/facebook-graph-sdk/src/Facebook/Exceptions/FacebookResumableUploadException.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/GraphNodes/Birthday.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/PersistentData/PersistentDataFactory.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php create mode 100644 lib/facebook-graph-sdk/src/Facebook/polyfills.php (limited to 'lib/facebook-graph-sdk/src/Facebook') diff --git a/lib/facebook-graph-sdk/src/Facebook/Authentication/AccessToken.php b/lib/facebook-graph-sdk/src/Facebook/Authentication/AccessToken.php index 582ea61..5d70073 100644 --- a/lib/facebook-graph-sdk/src/Facebook/Authentication/AccessToken.php +++ b/lib/facebook-graph-sdk/src/Facebook/Authentication/AccessToken.php @@ -1,6 +1,6 @@ metadata[$key])) { + if (isset($this->metadata[$key]) && $this->metadata[$key] !== 0) { $this->metadata[$key] = $this->convertTimestampToDateTime($this->metadata[$key]); } } diff --git a/lib/facebook-graph-sdk/src/Facebook/Authentication/OAuth2Client.php b/lib/facebook-graph-sdk/src/Facebook/Authentication/OAuth2Client.php index 8e364ec..94df9b7 100644 --- a/lib/facebook-graph-sdk/src/Facebook/Authentication/OAuth2Client.php +++ b/lib/facebook-graph-sdk/src/Facebook/Authentication/OAuth2Client.php @@ -1,6 +1,6 @@ getenv(static::APP_ID_ENV_NAME), + 'app_secret' => getenv(static::APP_SECRET_ENV_NAME), + 'default_graph_version' => static::DEFAULT_GRAPH_VERSION, + 'enable_beta_mode' => false, + 'http_client_handler' => null, + 'persistent_data_handler' => null, + 'pseudo_random_string_generator' => null, + 'url_detection_handler' => null, + ], $config); + + if (!$config['app_id']) { throw new FacebookSDKException('Required "app_id" key not supplied in config and could not find fallback environment variable "' . static::APP_ID_ENV_NAME . '"'); } - - $appSecret = isset($config['app_secret']) ? $config['app_secret'] : getenv(static::APP_SECRET_ENV_NAME); - if (!$appSecret) { + if (!$config['app_secret']) { throw new FacebookSDKException('Required "app_secret" key not supplied in config and could not find fallback environment variable "' . static::APP_SECRET_ENV_NAME . '"'); } - $this->app = new FacebookApp($appId, $appSecret); - - $httpClientHandler = null; - if (isset($config['http_client_handler'])) { - if ($config['http_client_handler'] instanceof FacebookHttpClientInterface) { - $httpClientHandler = $config['http_client_handler']; - } elseif ($config['http_client_handler'] === 'curl') { - $httpClientHandler = new FacebookCurlHttpClient(); - } elseif ($config['http_client_handler'] === 'stream') { - $httpClientHandler = new FacebookStreamHttpClient(); - } elseif ($config['http_client_handler'] === 'guzzle') { - $httpClientHandler = new FacebookGuzzleHttpClient(); - } else { - throw new \InvalidArgumentException('The http_client_handler must be set to "curl", "stream", "guzzle", or be an instance of Facebook\HttpClients\FacebookHttpClientInterface'); - } - } - - $enableBeta = isset($config['enable_beta_mode']) && $config['enable_beta_mode'] === true; - $this->client = new FacebookClient($httpClientHandler, $enableBeta); - - if (isset($config['url_detection_handler'])) { - if ($config['url_detection_handler'] instanceof UrlDetectionInterface) { - $this->urlDetectionHandler = $config['url_detection_handler']; - } else { - throw new \InvalidArgumentException('The url_detection_handler must be an instance of Facebook\Url\UrlDetectionInterface'); - } - } - - if (isset($config['pseudo_random_string_generator'])) { - if ($config['pseudo_random_string_generator'] instanceof PseudoRandomStringGeneratorInterface) { - $this->pseudoRandomStringGenerator = $config['pseudo_random_string_generator']; - } elseif ($config['pseudo_random_string_generator'] === 'mcrypt') { - $this->pseudoRandomStringGenerator = new McryptPseudoRandomStringGenerator(); - } elseif ($config['pseudo_random_string_generator'] === 'openssl') { - $this->pseudoRandomStringGenerator = new OpenSslPseudoRandomStringGenerator(); - } elseif ($config['pseudo_random_string_generator'] === 'urandom') { - $this->pseudoRandomStringGenerator = new UrandomPseudoRandomStringGenerator(); - } else { - throw new \InvalidArgumentException('The pseudo_random_string_generator must be set to "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface'); - } - } - - if (isset($config['persistent_data_handler'])) { - if ($config['persistent_data_handler'] instanceof PersistentDataInterface) { - $this->persistentDataHandler = $config['persistent_data_handler']; - } elseif ($config['persistent_data_handler'] === 'session') { - $this->persistentDataHandler = new FacebookSessionPersistentDataHandler(); - } elseif ($config['persistent_data_handler'] === 'memory') { - $this->persistentDataHandler = new FacebookMemoryPersistentDataHandler(); - } else { - throw new \InvalidArgumentException('The persistent_data_handler must be set to "session", "memory", or be an instance of Facebook\PersistentData\PersistentDataInterface'); - } - } + $this->app = new FacebookApp($config['app_id'], $config['app_secret']); + $this->client = new FacebookClient( + HttpClientsFactory::createHttpClient($config['http_client_handler']), + $config['enable_beta_mode'] + ); + $this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator( + $config['pseudo_random_string_generator'] + ); + $this->setUrlDetectionHandler($config['url_detection_handler'] ?: new FacebookUrlDetectionHandler()); + $this->persistentDataHandler = PersistentDataFactory::createPersistentDataHandler( + $config['persistent_data_handler'] + ); if (isset($config['default_access_token'])) { $this->setDefaultAccessToken($config['default_access_token']); } - if (isset($config['default_graph_version'])) { - $this->defaultGraphVersion = $config['default_graph_version']; - } else { - // @todo v6: Throw an InvalidArgumentException if "default_graph_version" is not set - $this->defaultGraphVersion = static::DEFAULT_GRAPH_VERSION; - } + // @todo v6: Throw an InvalidArgumentException if "default_graph_version" is not set + $this->defaultGraphVersion = $config['default_graph_version']; } /** @@ -257,13 +216,19 @@ class Facebook */ public function getUrlDetectionHandler() { - if (!$this->urlDetectionHandler instanceof UrlDetectionInterface) { - $this->urlDetectionHandler = new FacebookUrlDetectionHandler(); - } - return $this->urlDetectionHandler; } + /** + * Changes the URL detection handler. + * + * @param UrlDetectionInterface $urlDetectionHandler + */ + private function setUrlDetectionHandler(UrlDetectionInterface $urlDetectionHandler) + { + $this->urlDetectionHandler = $urlDetectionHandler; + } + /** * Returns the default AccessToken entity. * @@ -529,6 +494,27 @@ class Facebook return $this->lastResponse = $this->client->sendBatchRequest($batchRequest); } + /** + * Instantiates an empty FacebookBatchRequest entity. + * + * @param AccessToken|string|null $accessToken The top-level access token. Requests with no access token + * will fallback to this. + * @param string|null $graphVersion The Graph API version to use. + * @return FacebookBatchRequest + */ + public function newBatchRequest($accessToken = null, $graphVersion = null) + { + $accessToken = $accessToken ?: $this->defaultAccessToken; + $graphVersion = $graphVersion ?: $this->defaultGraphVersion; + + return new FacebookBatchRequest( + $this->app, + [], + $accessToken, + $graphVersion + ); + } + /** * Instantiates a new FacebookRequest entity. * @@ -586,4 +572,64 @@ class Facebook { return new FacebookVideo($pathToFile); } + + /** + * Upload a video in chunks. + * + * @param int $target The id of the target node before the /videos edge. + * @param string $pathToFile The full path to the file. + * @param array $metadata The metadata associated with the video file. + * @param string|null $accessToken The access token. + * @param int $maxTransferTries The max times to retry a failed upload chunk. + * @param string|null $graphVersion The Graph API version to use. + * + * @return array + * + * @throws FacebookSDKException + */ + public function uploadVideo($target, $pathToFile, $metadata = [], $accessToken = null, $maxTransferTries = 5, $graphVersion = null) + { + $accessToken = $accessToken ?: $this->defaultAccessToken; + $graphVersion = $graphVersion ?: $this->defaultGraphVersion; + + $uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion); + $endpoint = '/'.$target.'/videos'; + $file = $this->videoToUpload($pathToFile); + $chunk = $uploader->start($endpoint, $file); + + do { + $chunk = $this->maxTriesTransfer($uploader, $endpoint, $chunk, $maxTransferTries); + } while (!$chunk->isLastChunk()); + + return [ + 'video_id' => $chunk->getVideoId(), + 'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata), + ]; + } + + /** + * Attempts to upload a chunk of a file in $retryCountdown tries. + * + * @param FacebookResumableUploader $uploader + * @param string $endpoint + * @param FacebookTransferChunk $chunk + * @param int $retryCountdown + * + * @return FacebookTransferChunk + * + * @throws FacebookSDKException + */ + private function maxTriesTransfer(FacebookResumableUploader $uploader, $endpoint, FacebookTransferChunk $chunk, $retryCountdown) + { + $newChunk = $uploader->transfer($endpoint, $chunk, $retryCountdown < 1); + + if ($newChunk !== $chunk) { + return $newChunk; + } + + $retryCountdown--; + + // If transfer() returned the same chunk entity, the transfer failed but is resumable. + return $this->maxTriesTransfer($uploader, $endpoint, $chunk, $retryCountdown); + } } diff --git a/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php b/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php index 84956ce..804c9bb 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php +++ b/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php @@ -1,6 +1,6 @@ id = $id; + if (!is_string($id) + // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false + && !is_int($id)) { + throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.'); + } + // We cast as a string in case a valid int was set on a 64-bit system and this is unserialised on a 32-bit system + $this->id = (string) $id; $this->secret = $secret; } @@ -84,7 +93,7 @@ class FacebookApp implements \Serializable */ public function serialize() { - return serialize([$this->id, $this->secret]); + return implode('|', [$this->id, $this->secret]); } /** @@ -94,7 +103,7 @@ class FacebookApp implements \Serializable */ public function unserialize($serialized) { - list($id, $secret) = unserialize($serialized); + list($id, $secret) = explode('|', $serialized); $this->__construct($id, $secret); } diff --git a/lib/facebook-graph-sdk/src/Facebook/FacebookBatchRequest.php b/lib/facebook-graph-sdk/src/Facebook/FacebookBatchRequest.php index 33c489c..3d5d5d5 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FacebookBatchRequest.php +++ b/lib/facebook-graph-sdk/src/Facebook/FacebookBatchRequest.php @@ -1,6 +1,6 @@ $req) { @@ -85,17 +86,28 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, throw new \InvalidArgumentException('Argument for add() must be of type array or FacebookRequest.'); } + if (null === $options) { + $options = []; + } elseif (!is_array($options)) { + $options = ['name' => $options]; + } + $this->addFallbackDefaults($request); + + // File uploads + $attachedFiles = $this->extractFileAttachments($request); + + $name = isset($options['name']) ? $options['name'] : null; + + unset($options['name']); + $requestToAdd = [ 'name' => $name, 'request' => $request, + 'options' => $options, + 'attached_files' => $attachedFiles, ]; - // File uploads - $attachedFiles = $this->extractFileAttachments($request); - if ($attachedFiles) { - $requestToAdd['attached_files'] = $attachedFiles; - } $this->requests[] = $requestToAdd; return $this; @@ -168,8 +180,6 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, /** * Prepares the requests to be sent as a batch request. - * - * @return string */ public function prepareRequestsForBatch() { @@ -191,8 +201,15 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, { $requests = []; foreach ($this->requests as $request) { - $attachedFiles = isset($request['attached_files']) ? $request['attached_files'] : null; - $requests[] = $this->requestEntityToBatchArray($request['request'], $request['name'], $attachedFiles); + $options = []; + + if (null !== $request['name']) { + $options['name'] = $request['name']; + } + + $options += $request['options']; + + $requests[] = $this->requestEntityToBatchArray($request['request'], $options, $request['attached_files']); } return json_encode($requests); @@ -217,14 +234,22 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, /** * Converts a Request entity into an array that is batch-friendly. * - * @param FacebookRequest $request The request entity to convert. - * @param string|null $requestName The name of the request. - * @param string|null $attachedFiles Names of files associated with the request. + * @param FacebookRequest $request The request entity to convert. + * @param string|null|array $options Array of batch request options e.g. 'name', 'omit_response_on_success'. + * If a string is given, it is the value of the 'name' option. + * @param string|null $attachedFiles Names of files associated with the request. * * @return array */ - public function requestEntityToBatchArray(FacebookRequest $request, $requestName = null, $attachedFiles = null) + public function requestEntityToBatchArray(FacebookRequest $request, $options = null, $attachedFiles = null) { + + if (null === $options) { + $options = []; + } elseif (!is_array($options)) { + $options = ['name' => $options]; + } + $compiledHeaders = []; $headers = $request->getHeaders(); foreach ($headers as $name => $value) { @@ -244,18 +269,12 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, $batch['body'] = $body; } - if (isset($requestName)) { - $batch['name'] = $requestName; - } + $batch += $options; - if (isset($attachedFiles)) { + if (null !== $attachedFiles) { $batch['attached_files'] = $attachedFiles; } - // @TODO Add support for "omit_response_on_success" - // @TODO Add support for "depends_on" - // @TODO Add support for JSONP with "callback" - return $batch; } diff --git a/lib/facebook-graph-sdk/src/Facebook/FacebookBatchResponse.php b/lib/facebook-graph-sdk/src/Facebook/FacebookBatchResponse.php index 5ea765e..8e1464c 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FacebookBatchResponse.php +++ b/lib/facebook-graph-sdk/src/Facebook/FacebookBatchResponse.php @@ -1,6 +1,6 @@ normalizeBatchHeaders($response['headers']) : []; $this->responses[$originalRequestName] = new FacebookResponse( $originalRequest, @@ -151,4 +152,23 @@ class FacebookBatchResponse extends FacebookResponse implements IteratorAggregat { return isset($this->responses[$offset]) ? $this->responses[$offset] : null; } + + /** + * Converts the batch header array into a standard format. + * @TODO replace with array_column() when PHP 5.5 is supported. + * + * @param array $batchHeaders + * + * @return array + */ + private function normalizeBatchHeaders(array $batchHeaders) + { + $headers = []; + + foreach ($batchHeaders as $header) { + $headers[$header['name']] = $header['value']; + } + + return $headers; + } } diff --git a/lib/facebook-graph-sdk/src/Facebook/FacebookClient.php b/lib/facebook-graph-sdk/src/Facebook/FacebookClient.php index b10762f..dbf7592 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FacebookClient.php +++ b/lib/facebook-graph-sdk/src/Facebook/FacebookClient.php @@ -1,6 +1,6 @@ validateAccessToken(); } diff --git a/lib/facebook-graph-sdk/src/Facebook/FacebookRequest.php b/lib/facebook-graph-sdk/src/Facebook/FacebookRequest.php index 5e4083f..2b10089 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FacebookRequest.php +++ b/lib/facebook-graph-sdk/src/Facebook/FacebookRequest.php @@ -1,6 +1,6 @@ path = $filePath; + $this->maxLength = $maxLength; + $this->offset = $offset; $this->open(); } @@ -98,7 +112,7 @@ class FacebookFile */ public function getContents() { - return stream_get_contents($this->stream); + return stream_get_contents($this->stream, $this->maxLength, $this->offset); } /** @@ -111,6 +125,26 @@ class FacebookFile return basename($this->path); } + /** + * Return the path of the file. + * + * @return string + */ + public function getFilePath() + { + return $this->path; + } + + /** + * Return the size of the file. + * + * @return int + */ + public function getSize() + { + return filesize($this->path); + } + /** * Return the mimetype of the file. * diff --git a/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php new file mode 100644 index 0000000..92a22f1 --- /dev/null +++ b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookResumableUploader.php @@ -0,0 +1,167 @@ +app = $app; + $this->client = $client; + $this->accessToken = $accessToken; + $this->graphVersion = $graphVersion; + } + + /** + * Upload by chunks - start phase + * + * @param string $endpoint + * @param FacebookFile $file + * + * @return FacebookTransferChunk + * + * @throws FacebookSDKException + */ + public function start($endpoint, FacebookFile $file) + { + $params = [ + 'upload_phase' => 'start', + 'file_size' => $file->getSize(), + ]; + $response = $this->sendUploadRequest($endpoint, $params); + + return new FacebookTransferChunk($file, $response['upload_session_id'], $response['video_id'], $response['start_offset'], $response['end_offset']); + } + + /** + * Upload by chunks - transfer phase + * + * @param string $endpoint + * @param FacebookTransferChunk $chunk + * @param boolean $allowToThrow + * + * @return FacebookTransferChunk + * + * @throws FacebookResponseException + */ + public function transfer($endpoint, FacebookTransferChunk $chunk, $allowToThrow = false) + { + $params = [ + 'upload_phase' => 'transfer', + 'upload_session_id' => $chunk->getUploadSessionId(), + 'start_offset' => $chunk->getStartOffset(), + 'video_file_chunk' => $chunk->getPartialFile(), + ]; + + try { + $response = $this->sendUploadRequest($endpoint, $params); + } catch (FacebookResponseException $e) { + $preException = $e->getPrevious(); + if ($allowToThrow || !$preException instanceof FacebookResumableUploadException) { + throw $e; + } + + // Return the same chunk entity so it can be retried. + return $chunk; + } + + return new FacebookTransferChunk($chunk->getFile(), $chunk->getUploadSessionId(), $chunk->getVideoId(), $response['start_offset'], $response['end_offset']); + } + + /** + * Upload by chunks - finish phase + * + * @param string $endpoint + * @param string $uploadSessionId + * @param array $metadata The metadata associated with the file. + * + * @return boolean + * + * @throws FacebookSDKException + */ + public function finish($endpoint, $uploadSessionId, $metadata = []) + { + $params = array_merge($metadata, [ + 'upload_phase' => 'finish', + 'upload_session_id' => $uploadSessionId, + ]); + $response = $this->sendUploadRequest($endpoint, $params); + + return $response['success']; + } + + /** + * Helper to make a FacebookRequest and send it. + * + * @param string $endpoint The endpoint to POST to. + * @param array $params The params to send with the request. + * + * @return array + */ + private function sendUploadRequest($endpoint, $params = []) + { + $request = new FacebookRequest($this->app, $this->accessToken, 'POST', $endpoint, $params, null, $this->graphVersion); + + return $this->client->sendRequest($request)->getDecodedBody(); + } +} diff --git a/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php new file mode 100644 index 0000000..a909e87 --- /dev/null +++ b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookTransferChunk.php @@ -0,0 +1,133 @@ +file = $file; + $this->uploadSessionId = $uploadSessionId; + $this->videoId = $videoId; + $this->startOffset = $startOffset; + $this->endOffset = $endOffset; + } + + /** + * Return the file entity. + * + * @return FacebookFile + */ + public function getFile() + { + return $this->file; + } + + /** + * Return a FacebookFile entity with partial content. + * + * @return FacebookFile + */ + public function getPartialFile() + { + $maxLength = $this->endOffset - $this->startOffset; + + return new FacebookFile($this->file->getFilePath(), $maxLength, $this->startOffset); + } + + /** + * Return upload session Id + * + * @return int + */ + public function getUploadSessionId() + { + return $this->uploadSessionId; + } + + /** + * Check whether is the last chunk + * + * @return bool + */ + public function isLastChunk() + { + return $this->startOffset === $this->endOffset; + } + + /** + * @return int + */ + public function getStartOffset() + { + return $this->startOffset; + } + + /** + * Get uploaded video Id + * + * @return int + */ + public function getVideoId() + { + return $this->videoId; + } +} diff --git a/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookVideo.php b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookVideo.php index 1e8c55a..ee6dd53 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookVideo.php +++ b/lib/facebook-graph-sdk/src/Facebook/FileUpload/FacebookVideo.php @@ -1,6 +1,6 @@ 'application/scvp-vp-request', 'spx' => 'audio/ogg', 'src' => 'application/x-wais-source', + 'srt' => 'application/octet-stream', 'sru' => 'application/sru+xml', 'srx' => 'application/sparql-results+xml', 'sse' => 'application/vnd.kodak-descriptor', diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Birthday.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Birthday.php new file mode 100644 index 0000000..4338b65 --- /dev/null +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Birthday.php @@ -0,0 +1,85 @@ +hasYear = count($parts) === 3 || count($parts) === 1; + $this->hasDate = count($parts) === 3 || count($parts) === 2; + + parent::__construct($date); + } + + /** + * Returns whether date object contains birth day and month + * + * @return bool + */ + public function hasDate() + { + return $this->hasDate; + } + + /** + * Returns whether date object contains birth year + * + * @return bool + */ + public function hasYear() + { + return $this->hasYear; + } +} diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php index cac010b..424b7cf 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/Collection.php @@ -1,6 +1,6 @@ items[$name]; } - return $default ?: null; + return $default; } /** diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php index 3fba815..31508ee 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphAchievement.php @@ -1,6 +1,6 @@ validateForPagination(); // Do we have a paging URL? - if (isset($this->metaData['paging'][$direction])) { - // Graph returns the full URL with all the original params. - // We just want the endpoint though. - $pageUrl = $this->metaData['paging'][$direction]; - - return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl); - } - - // Do we have a cursor to work with? - $cursorDirection = $direction === 'next' ? 'after' : 'before'; - $cursor = $this->getCursor($cursorDirection); - if (!$cursor) { - return null; - } - - // If we don't know the ID of the parent node, this ain't gonna work. - if (!$this->parentEdgeEndpoint) { + if (!isset($this->metaData['paging'][$direction])) { return null; } - // We have the parent node ID, paging cursor & original request. - // These were the ingredients chosen to create the perfect little URL. - $pageUrl = $this->parentEdgeEndpoint . '?' . $cursorDirection . '=' . urlencode($cursor); + $pageUrl = $this->metaData['paging'][$direction]; - // Pull in the original params - $originalUrl = $this->request->getUrl(); - $pageUrl = FacebookUrlManipulator::mergeUrlParams($originalUrl, $pageUrl); - - return FacebookUrlManipulator::forceSlashPrefix($pageUrl); + return FacebookUrlManipulator::baseGraphUrlEndpoint($pageUrl); } /** @@ -257,4 +235,18 @@ class GraphEdge extends Collection return null; } + + /** + * @inheritDoc + */ + public function map(\Closure $callback) + { + return new static( + $this->request, + array_map($callback, $this->items, array_keys($this->items)), + $this->metaData, + $this->parentEdgeEndpoint, + $this->subclassName + ); + } } diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php index 19ff2fb..a470d89 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphEvent.php @@ -1,6 +1,6 @@ getField('venue'); } - } diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php index a60a07a..3dfbd49 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphList.php @@ -1,6 +1,6 @@ $v) { if ($this->shouldCastAsDateTime($k) && (is_numeric($v) - || $k === 'birthday' || $this->isIso8601DateString($v)) ) { $items[$k] = $this->castToDateTime($v); + } elseif ($k === 'birthday') { + $items[$k] = $this->castToBirthday($v); } else { $items[$k] = $v; } @@ -149,7 +150,6 @@ class GraphNode extends Collection 'backdated_time', 'issued_at', 'expires_at', - 'birthday', 'publish_time' ], true); } @@ -173,6 +173,18 @@ class GraphNode extends Collection return $dt; } + /** + * Casts a birthday value from Graph to Birthday + * + * @param string $value + * + * @return Birthday + */ + public function castToBirthday($value) + { + return new Birthday($value); + } + /** * Getter for $graphObjectMap. * diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php index e1bedd9..6a37091 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphNodeFactory.php @@ -1,6 +1,6 @@ safelyMakeGraphNode($graphNode, $subclassName, $parentKey, $parentNodeId); + $dataList[] = $this->safelyMakeGraphNode($graphNode, $subclassName); } $metaData = $this->getMetaData($data); diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php index bb8f8e4..0633c40 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphObject.php @@ -1,6 +1,6 @@ makeGraphNode($subclassName); } - + /** * Convenience method for creating a GraphEvent collection. * @@ -66,7 +68,7 @@ class GraphObjectFactory extends GraphNodeFactory */ public function makeGraphEvent() { - return $this->makeGraphObject(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent'); + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent'); } /** diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php index ab8e31a..3dfb0e0 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPage.php @@ -1,6 +1,6 @@ '\Facebook\GraphNodes\GraphPage', 'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage', 'location' => '\Facebook\GraphNodes\GraphLocation', + 'cover' => '\Facebook\GraphNodes\GraphCoverPhoto', + 'picture' => '\Facebook\GraphNodes\GraphPicture', ]; /** @@ -99,6 +101,26 @@ class GraphPage extends GraphNode return $this->getField('location'); } + /** + * Returns CoverPhoto of the Page. + * + * @return GraphCoverPhoto|null + */ + public function getCover() + { + return $this->getField('cover'); + } + + /** + * Returns Picture of the Page. + * + * @return GraphPicture|null + */ + public function getPicture() + { + return $this->getField('picture'); + } + /** * Returns the page access token for the admin user. * diff --git a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php index bfd37fa..10274ec 100644 --- a/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php +++ b/lib/facebook-graph-sdk/src/Facebook/GraphNodes/GraphPicture.php @@ -1,6 +1,6 @@ getField('last_name'); } + /** + * Returns the email for the user as a string if present. + * + * @return string|null + */ + public function getEmail() + { + return $this->getField('email'); + } + /** * Returns the gender for the user as a string if present. * @@ -113,7 +123,7 @@ class GraphUser extends GraphNode /** * Returns the users birthday, if available. * - * @return \DateTime|null + * @return Birthday|null */ public function getBirthday() { diff --git a/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php b/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php index 8068526..7f3466f 100644 --- a/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php +++ b/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookCanvasHelper.php @@ -1,6 +1,6 @@ oAuth2Client = $oAuth2Client; $this->persistentDataHandler = $persistentDataHandler ?: new FacebookSessionPersistentDataHandler(); $this->urlDetectionHandler = $urlHandler ?: new FacebookUrlDetectionHandler(); - $this->pseudoRandomStringGenerator = $prsg ?: $this->detectPseudoRandomStringGenerator(); + $this->pseudoRandomStringGenerator = PseudoRandomStringGeneratorFactory::createPseudoRandomStringGenerator($prsg); } /** @@ -112,32 +110,6 @@ class FacebookRedirectLoginHelper return $this->pseudoRandomStringGenerator; } - /** - * Detects which pseudo-random string generator to use. - * - * @return PseudoRandomStringGeneratorInterface - * - * @throws FacebookSDKException - */ - public function detectPseudoRandomStringGenerator() - { - // Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically - // secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv() first. - if (function_exists('mcrypt_create_iv')) { - return new McryptPseudoRandomStringGenerator(); - } - - if (function_exists('openssl_random_pseudo_bytes')) { - return new OpenSslPseudoRandomStringGenerator(); - } - - if (!ini_get('open_basedir') && is_readable('/dev/urandom')) { - return new UrandomPseudoRandomStringGenerator(); - } - - throw new FacebookSDKException('Unable to detect a cryptographically secure pseudo-random string generator.'); - } - /** * Stores CSRF state and returns a URL to which the user should be sent to in order to continue the login process with Facebook. * @@ -150,7 +122,7 @@ class FacebookRedirectLoginHelper */ private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&') { - $state = $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH); + $state = $this->persistentDataHandler->get('state') ?: $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH); $this->persistentDataHandler->set('state', $state); return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator); @@ -247,10 +219,11 @@ class FacebookRedirectLoginHelper } $this->validateCsrf(); + $this->resetCsrf(); $redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl(); - // At minimum we need to remove the state param - $redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']); + // At minimum we need to remove the 'state' and 'code' params + $redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['code', 'state']); return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl); } @@ -263,27 +236,27 @@ class FacebookRedirectLoginHelper protected function validateCsrf() { $state = $this->getState(); + if (!$state) { + throw new FacebookSDKException('Cross-site request forgery validation failed. Required GET param "state" missing.'); + } $savedState = $this->persistentDataHandler->get('state'); - - if (!$state || !$savedState) { - throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing.'); + if (!$savedState) { + throw new FacebookSDKException('Cross-site request forgery validation failed. Required param "state" missing from persistent data.'); } - $savedLen = strlen($savedState); - $givenLen = strlen($state); - - if ($savedLen !== $givenLen) { - throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.'); + if (\hash_equals($savedState, $state)) { + return; } - $result = 0; - for ($i = 0; $i < $savedLen; $i++) { - $result |= ord($state[$i]) ^ ord($savedState[$i]); - } + throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.'); + } - if ($result !== 0) { - throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.'); - } + /** + * Resets the CSRF so that it doesn't get reused. + */ + private function resetCsrf() + { + $this->persistentDataHandler->set('state', null); } /** diff --git a/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php b/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php index aafa246..4044da1 100644 --- a/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +++ b/lib/facebook-graph-sdk/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php @@ -1,6 +1,6 @@ setHttpResponseCodeFromHeader($line); } else { - list($key, $value) = explode(': ', $line); + list($key, $value) = explode(': ', $line, 2); $this->headers[$key] = $value; } } diff --git a/lib/facebook-graph-sdk/src/Facebook/Http/RequestBodyInterface.php b/lib/facebook-graph-sdk/src/Facebook/Http/RequestBodyInterface.php index 97e0a2e..1c03f4f 100644 --- a/lib/facebook-graph-sdk/src/Facebook/Http/RequestBodyInterface.php +++ b/lib/facebook-graph-sdk/src/Facebook/Http/RequestBodyInterface.php @@ -1,6 +1,6 @@ $url, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => $timeOut, - CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects + CURLOPT_RETURNTRANSFER => true, // Return response as string CURLOPT_HEADER => true, // Enable header processing CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_SSL_VERIFYPEER => true, @@ -164,47 +154,10 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface */ public function extractResponseHeadersAndBody() { - $headerSize = $this->getHeaderSize(); - - $rawHeaders = mb_substr($this->rawResponse, 0, $headerSize); - $rawBody = mb_substr($this->rawResponse, $headerSize); + $parts = explode("\r\n\r\n", $this->rawResponse); + $rawBody = array_pop($parts); + $rawHeaders = implode("\r\n\r\n", $parts); return [trim($rawHeaders), trim($rawBody)]; } - - /** - * Return proper header size - * - * @return integer - */ - private function getHeaderSize() - { - $headerSize = $this->facebookCurl->getinfo(CURLINFO_HEADER_SIZE); - // This corrects a Curl bug where header size does not account - // for additional Proxy headers. - if ($this->needsCurlProxyFix()) { - // Additional way to calculate the request body size. - if (preg_match('/Content-Length: (\d+)/', $this->rawResponse, $m)) { - $headerSize = mb_strlen($this->rawResponse) - $m[1]; - } elseif (stripos($this->rawResponse, self::CONNECTION_ESTABLISHED) !== false) { - $headerSize += mb_strlen(self::CONNECTION_ESTABLISHED); - } - } - - return $headerSize; - } - - /** - * Detect versions of Curl which report incorrect header lengths when - * using Proxies. - * - * @return boolean - */ - private function needsCurlProxyFix() - { - $ver = $this->facebookCurl->version(); - $version = $ver['version_number']; - - return $version < self::CURL_PROXY_QUIRK_VER; - } } diff --git a/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php b/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php index 6f2a1c6..8feb7cb 100644 --- a/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +++ b/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php @@ -1,6 +1,6 @@ stream); - $this->responseHeaders = $http_response_header; + $this->responseHeaders = $http_response_header ?: []; return $rawResponse; } diff --git a/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php b/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php index b157514..1cdfd53 100644 --- a/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php +++ b/lib/facebook-graph-sdk/src/Facebook/HttpClients/FacebookStreamHttpClient.php @@ -1,6 +1,6 @@ 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); } diff --git a/lib/facebook-graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php b/lib/facebook-graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php new file mode 100644 index 0000000..d9f2a8d --- /dev/null +++ b/lib/facebook-graph-sdk/src/Facebook/HttpClients/HttpClientsFactory.php @@ -0,0 +1,99 @@ +validateLength($length); + + return $this->binToHex(random_bytes($length), $length); + } +} diff --git a/lib/facebook-graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php b/lib/facebook-graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php index 0f9cacd..5ab434e 100644 --- a/lib/facebook-graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +++ b/lib/facebook-graph-sdk/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php @@ -1,6 +1,6 @@ getHeader('X_FORWARDED_HOST')) { - $elements = explode(',', $host); + $header = $this->getHeader('X_FORWARDED_HOST'); + if ($header && $this->isValidForwardedHost($header)) { + $elements = explode(',', $header); $host = $elements[count($elements) - 1]; } elseif (!$host = $this->getHeader('HOST')) { if (!$host = $this->getServerVar('SERVER_NAME')) { @@ -160,4 +161,22 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface { return $this->getServerVar('HTTP_' . $key); } + + /** + * Checks if the value in X_FORWARDED_HOST is a valid hostname + * Could prevent unintended redirections + * + * @param string $header + * + * @return boolean + */ + protected function isValidForwardedHost($header) + { + $elements = explode(',', $header); + $host = $elements[count($elements) - 1]; + + return preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check + && 0 < strlen($host) && strlen($host) < 254 //overall length check + && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host); //length of each label + } } diff --git a/lib/facebook-graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php b/lib/facebook-graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php index 20a0299..daeab9c 100644 --- a/lib/facebook-graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php +++ b/lib/facebook-graph-sdk/src/Facebook/Url/FacebookUrlManipulator.php @@ -1,6 +1,6 @@