diff --git a/src/Http/Utility.php b/src/Http/Utility.php index eb02252..5831038 100644 --- a/src/Http/Utility.php +++ b/src/Http/Utility.php @@ -120,7 +120,7 @@ public function toAuthorizationHeader(array $params, $realm = null, $excludeCust */ public function sign( array $params, - string $signatureMethod, + $signatureMethod, $consumerSecret, $tokenSecret = null, $method = null, @@ -128,7 +128,7 @@ public function sign( ) { $className = ''; $hashAlgo = null; - $parts = explode('-', $signatureMethod); + $parts = explode('-', (string) $signatureMethod); if (count($parts) > 1) { $className = 'Laminas\OAuth\Signature\\' . ucfirst(strtolower($parts[0])); $hashAlgo = $parts[1]; @@ -189,9 +189,9 @@ public function generateTimestamp() * @param string $value * @return string */ - public static function urlEncode(string $value) + public static function urlEncode($value) { - $encoded = rawurlencode($value); + $encoded = rawurlencode((string) $value); $encoded = str_replace('%7E', '~', $encoded); return $encoded; } diff --git a/test/OAuthTest.php b/test/OAuthTest.php index cf49216..4b3f5d2 100644 --- a/test/OAuthTest.php +++ b/test/OAuthTest.php @@ -94,9 +94,7 @@ public function testOauthClientUsingGetRequestParametersForSignature() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token, - 'consumerSecret' => '', // for PHP 8.1 compatibility - 'consumerKey' => '' + 'token' => $token ], 'http://www.example.com'); $client->getRequest()->getQuery()->set('foo', 'bar'); $client->prepareOAuth(); @@ -126,9 +124,7 @@ public function testOauthClientUsingPostRequestParametersForSignature() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token, - 'consumerSecret' => '', // for PHP 8.1 compatibility - 'consumerKey' => '' + 'token' => $token ], 'http://www.example.com'); $client->getRequest()->getPost()->set('foo', 'bar'); $client->prepareOAuth(); @@ -158,9 +154,7 @@ public function testOauthClientUsingPostAndGetRequestParametersForSignature() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token, - 'consumerSecret' => '', // for PHP 8.1 compatibility - 'consumerKey' => '' + 'token' => $token ], 'http://www.example.com'); $client->getRequest()->getPost()->set('foo', 'bar'); $client->getRequest()->getQuery()->set('baz', 'bat'); @@ -192,9 +186,7 @@ public function testOAuthClientDoesntOverrideExistingHeaders() ->setTokenSecret('456'); $client = new OAuthClient([ - 'token' => $token, - 'consumerSecret' => '', // for PHP 8.1 compatibility - 'consumerKey' => '' + 'token' => $token ], 'http://www.example.com'); $dummyHeader = Header\ContentType::fromString('Content-Type: application/octet-stream'); diff --git a/test/TestAsset/HTTPUtility32874.php b/test/TestAsset/HTTPUtility32874.php index df1241d..7d8becc 100644 --- a/test/TestAsset/HTTPUtility32874.php +++ b/test/TestAsset/HTTPUtility32874.php @@ -22,7 +22,7 @@ public function generateTimestamp() public function sign( array $params, - string $signatureMethod, + $signatureMethod, $consumerSecret, $accessTokenSecret = null, $method = null, diff --git a/test/TestAsset/HTTPUtility39745.php b/test/TestAsset/HTTPUtility39745.php index 1c92346..020bb3e 100644 --- a/test/TestAsset/HTTPUtility39745.php +++ b/test/TestAsset/HTTPUtility39745.php @@ -22,7 +22,7 @@ public function generateTimestamp() public function sign( array $params, - string $signatureMethod, + $signatureMethod, $consumerSecret, $accessTokenSecret = null, $method = null, diff --git a/test/TestAsset/HTTPUtility90244.php b/test/TestAsset/HTTPUtility90244.php index 084b805..c54af83 100644 --- a/test/TestAsset/HTTPUtility90244.php +++ b/test/TestAsset/HTTPUtility90244.php @@ -22,7 +22,7 @@ public function generateTimestamp() public function sign( array $params, - string $signatureMethod, + $signatureMethod, $consumerSecret, $accessTokenSecret = null, $method = null,