Skip to content

Commit 6d22906

Browse files
authored
Merge pull request #48 from johmanx10/issue-47
Fix passing null to parameter of type string
2 parents 0655386 + 626b7e9 commit 6d22906

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- "7.3"
1919
- "7.4"
2020
- "8.0"
21+
- "8.1"
2122

2223
steps:
2324
- uses: actions/checkout@v2

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ public function __construct($secret)
1414

1515
/**
1616
* @param string $signature
17-
* @param string $payload
17+
* @param ?string $payload
1818
* @return bool
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)