-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
7 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,9 @@ public function postAction(Request $request): Response | |
return new Response('', Response::HTTP_UNAUTHORIZED); | ||
} | ||
|
||
/** @var string|resource $body on Symfony 5 the annotation is resource|string */ | ||
Check failure on line 85 in src/Controller/WebhookController.php GitHub Actions / Sylius ^1.12, PHP 8.0, Symfony ^5.4, MySQL 8.0UnnecessaryVarAnnotation
Check failure on line 85 in src/Controller/WebhookController.php GitHub Actions / Sylius ^1.12, PHP 8.0, Symfony ^5.4, MySQL 8.0UnnecessaryVarAnnotation
|
||
$body = $request->getContent(); | ||
$expectedSignature = hash_hmac('sha256', $timestamp . '.' . $body, $this->secret); | ||
$expectedSignature = hash_hmac('sha256', $timestamp . '.' . (string) $body, $this->secret); | ||
if (false === hash_equals($signature, $expectedSignature)) { | ||
$this->logger->debug('The hash does not match! The request is not from Akeneo or the secret is wrong.'); | ||
|
||
|
@@ -100,7 +101,7 @@ public function postAction(Request $request): Response | |
* | ||
* @var AkeneoEvents $akeneoEvents | ||
*/ | ||
$akeneoEvents = json_decode($body, true, 512, JSON_THROW_ON_ERROR); | ||
$akeneoEvents = json_decode((string) $body, true, 512, JSON_THROW_ON_ERROR); | ||
|
||
foreach ($akeneoEvents['events'] as $akeneoEvent) { | ||
$this->logger->debug(sprintf('Received event %s with id "%s"', $akeneoEvent['action'], $akeneoEvent['event_id'])); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters