KaufmannDigital / KaufmannDigital.GDPR.CookieConsent

A ready-to-run package, that integrates an advanced cookie consent banner into your Neos CMS site.
https://www.kaufmann.digital/neos-cms/plugins/dsgvo-gdpr-cookie-consent
GNU General Public License v3.0
26 stars 11 forks source link

Fix type error when no consents have been set yet #48

Closed kdambekalns closed 1 year ago

kdambekalns commented 2 years ago

Make sure $consents is an array instead of null when not set in $cookie at all.

Fixes #47

Nikdro commented 2 years ago

Thanks for your PR @kdambekalns!

Unfortunately, I could not reproduce the problem. The code is located in a try-catch block. This should actually ensure that these exceptions get catched and an empty JavaScript is generated, as long as not all necessary parameters are set via the cookie.

In my tests, the whole thing worked, so that it never came to the error (PHP 8.1). Only if I remove the try-catch block, I get an error.
The fix does not lead to any other error, but I still get other exceptions with the fix, which lead to the same result with try-catch.

Maybe I'm missing something and you can help me out.... You can also reach my via Slack, if thats easier :)

Nikdro commented 1 year ago

Hi @kdambekalns, I wasn't able again to reproduce your described problem. But since this should not break something and it worked for me in my tests, I'll get this into v5 now.

kdambekalns commented 1 year ago

Sorry for not getting back to this, I had hoped to find time to verify it again. But the issue was real… 🤷‍♂️

Thanks for merging! ❤️‍🔥