Skip to content

Commit bb202fc

Browse files
author
Jan-Marten de Boer
committed
Fix passing null to parameter of type string
Passing `null` to internal PHP functions, with argument type of string is deprecated in PHP 8.1. This can be easily fixed by supplying empty strings instead.
1 parent 0655386 commit bb202fc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/HttpClient/Plugin/RequestSignature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ private function normalizeParameters(array $params)
8484
{
8585
uksort($params, 'strcmp');
8686

87-
return http_build_query($params, null, '&', PHP_QUERY_RFC3986);
87+
return http_build_query($params, '', '&', PHP_QUERY_RFC3986);
8888
}
8989
}

src/WebhookSignature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct($secret)
1919
*/
2020
public function validate($signature, $payload)
2121
{
22-
$payloadSignature = 'sha1='.hash_hmac('sha1', $payload, $this->secret);
22+
$payloadSignature = 'sha1='.hash_hmac('sha1', $payload ?? '', $this->secret);
2323

2424
return hash_equals($payloadSignature, (string) $signature);
2525
}

0 commit comments

Comments
 (0)