Skip to content

Commit

Permalink
Fix: errors thrown when cookie is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
hphoeksma authored and Nikdro committed Jan 4, 2023
1 parent eba0999 commit 56e6d6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/Controller/JavaScriptController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ function ($key) {
array_map(function ($dimension) { return current($dimension);}, $filteredDimensions)
);

$cookie = json_decode($this->request->getHttpRequest()->getCookieParams()[$this->cookieName], true);
$consents = isset($cookie['consents'][$dimensionIdentifier]) ? $cookie['consents'][$dimensionIdentifier] : $cookie['consents']['default'] ?? $cookie['consents'];
$cookie = isset($this->request->getHttpRequest()->getCookieParams()[$this->cookieName]) ? json_decode($this->request->getHttpRequest()->getCookieParams()[$this->cookieName], true) : null;
$consents = $cookie['consents'][$dimensionIdentifier] ?? $cookie['consents']['default'] ?? $cookie['consents'] ?? [];
$siteNode = $this->contextFactory->create(['dimensions' => $dimensions])->getCurrentSiteNode();

$cacheIdentifier = 'kd_gdpr_cc_' . sha1(json_encode($consents) . $dimensionIdentifier . $siteNode->getIdentifier());
Expand Down

0 comments on commit 56e6d6f

Please sign in to comment.