Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html_entity_decode() expects parameter 1 to be string, array given #3

Open
theroch opened this issue Mar 13, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@theroch
Copy link

theroch commented Mar 13, 2024

Bug description

We've update to klaro-consent-manager 1.3.0 yesterday.
After the update our website was not more accesible because of an internal error.
The log was flooded with the following entries:
request.CRITICAL: Uncaught PHP Exception TypeError: "html_entity_decode() expects parameter 1 to be string, array given" at /contao/vendor/pdir/klaro-consent-manager/src/Hooks/GeneratePageHook.php line 262 {"exception":"[object] (TypeError(code: 0): html_entity_decode() expects parameter 1 to be string, array given at /contao/vendor/pdir/klaro-consent-manager/src/Hooks/GeneratePageHook.php:262)"} []

Steps to reproduce

Upgrade to klaro-consent-manager and try to open the web page

Expected behavior

Website comes up

Screenshots

Environment

PHP 7.4
Contao 4.13.38

Bugfix

We've located the error in commit 7f67496 in src/Hooks/GeneratePageHook.php

We've changed line 261 in src/Hooks/GeneratePageHook.php from
array_walk($arrCookies, static function ($cookie) use (&$arrResult): void { $arrResult[] = html_entity_decode(str_replace(''', "'", $cookie)); });
to
array_walk($arrCookies, static function ($cookie) use (&$arrResult): void { $arrResult[] = html_entity_decode(str_replace(''', "'", $cookie['key'])); });

after this patch the website operates normally.

@theroch theroch added the bug Something isn't working label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant