diff --git a/CHANGELOG.md b/CHANGELOG.md index c0f80d0b9..76eb8536c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Starting with version 5, the Facebook PHP SDK follows [SemVer](http://semver.org Version 5 of the Facebook PHP SDK is a complete refactor of version 4. It comes loaded with lots of new features and a friendlier API. +- 5.9.0 (2022-01-20) Support php8.1 - 5.7.1 (2018-XX-XX) - 5.7.0 (2018-12-12) - Add `joined` to list of fields to be cast to `\DateTime` (#950) diff --git a/composer.json b/composer.json index 9d54abc37..9a0313fce 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^5.4|^7.0" + "php": "^5.4|^7.0|^8.0" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/src/Facebook/Authentication/OAuth2Client.php b/src/Facebook/Authentication/OAuth2Client.php index 94df9b7b5..3ba05d80a 100644 --- a/src/Facebook/Authentication/OAuth2Client.php +++ b/src/Facebook/Authentication/OAuth2Client.php @@ -143,7 +143,7 @@ public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], arr 'scope' => implode(',', $scope) ]; - return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, null, $separator); + return static::BASE_AUTHORIZATION_URL . '/' . $this->graphVersion . '/dialog/oauth?' . http_build_query($params, '', $separator); } /** diff --git a/src/Facebook/FacebookApp.php b/src/Facebook/FacebookApp.php index 804c9bb56..a7a962ab7 100644 --- a/src/Facebook/FacebookApp.php +++ b/src/Facebook/FacebookApp.php @@ -47,8 +47,8 @@ class FacebookApp implements \Serializable public function __construct($id, $secret) { if (!is_string($id) - // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false - && !is_int($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 @@ -91,9 +91,9 @@ public function getAccessToken() * * @return string */ - public function serialize() + public function serialize(): string { - return implode('|', [$this->id, $this->secret]); + return implode('|', $this->__serialize()); } /** @@ -101,10 +101,25 @@ public function serialize() * * @param string $serialized */ - public function unserialize($serialized) + public function unserialize(string $serialized): void { - list($id, $secret) = explode('|', $serialized); + $this->__unserialize(explode('|', $serialized)); + } + /** + * @internal + */ + public function __serialize(): array + { + return [$this->id, $this->secret]; + } + + /** + * @internal + */ + public function __unserialize(array $data): void + { + list($id, $secret) = $data; $this->__construct($id, $secret); } } diff --git a/src/Facebook/Http/RequestBodyMultipart.php b/src/Facebook/Http/RequestBodyMultipart.php index e43695a4f..949080e9c 100644 --- a/src/Facebook/Http/RequestBodyMultipart.php +++ b/src/Facebook/Http/RequestBodyMultipart.php @@ -144,7 +144,7 @@ private function getParamString($name, $value) */ private function getNestedParams(array $params) { - $query = http_build_query($params, null, '&'); + $query = http_build_query($params, '', '&'); $params = explode('&', $query); $result = []; diff --git a/src/Facebook/Http/RequestBodyUrlEncoded.php b/src/Facebook/Http/RequestBodyUrlEncoded.php index c1e35f43d..dee58b9f8 100644 --- a/src/Facebook/Http/RequestBodyUrlEncoded.php +++ b/src/Facebook/Http/RequestBodyUrlEncoded.php @@ -50,6 +50,6 @@ public function __construct(array $params) */ public function getBody() { - return http_build_query($this->params, null, '&'); + return http_build_query($this->params, '', '&'); } } diff --git a/src/Facebook/Url/FacebookUrlManipulator.php b/src/Facebook/Url/FacebookUrlManipulator.php index daeab9c52..490ed1d91 100644 --- a/src/Facebook/Url/FacebookUrlManipulator.php +++ b/src/Facebook/Url/FacebookUrlManipulator.php @@ -53,7 +53,7 @@ public static function removeParamsFromUrl($url, array $paramsToFilter) } if (count($params) > 0) { - $query = '?' . http_build_query($params, null, '&'); + $query = '?' . http_build_query($params, '', '&'); } } @@ -81,7 +81,7 @@ public static function appendParamsToUrl($url, array $newParams = []) } if (strpos($url, '?') === false) { - return $url . '?' . http_build_query($newParams, null, '&'); + return $url . '?' . http_build_query($newParams, '', '&'); } list($path, $query) = explode('?', $url, 2); @@ -94,7 +94,7 @@ public static function appendParamsToUrl($url, array $newParams = []) // Sort for a predicable order ksort($newParams); - return $path . '?' . http_build_query($newParams, null, '&'); + return $path . '?' . http_build_query($newParams, '', '&'); } /**