Cookie bf_consent does not initially exist
robertkendrick opened this issue · comments
robertkendrick commented
Great work Lonnie
PHP: 8.1.4
File: ConsentFilter.php
$cookie = get_cookie('bf_consent');
$permissions = json_decode($cookie, true); // Fails here because $cookie is NULL. $cookie cannot be null, deprecated.
// Do we already have consent from the visitor?
// then nothing to do here...
if ($permissions['consent'] ?? false) {
return;
}
Presume just need to check for null and if so go straight to consent form
kgrruz commented
I believe even ci4 doesn't support version 8.1.x at the moment. Bonfire2 "follows" him on this subject.
robertkendrick commented
Yes, its runs better on PHP 7.4 with fewer problems. I'm sure it will just keep getting better and better.
By the by, Github Codeigniter 4 says required PHP is 7.4 or higher.
Github Bonfire2 says required PHP is same as Codeigniter 4.
kgrruz commented
My apologies. I don't checked before answer. You are right: codeigniter4/CodeIgniter4#4883
Antonio Sanna commented
I solved it this way:
$cookie = get_cookie('bf_consent');
if($cookie!=null) {
$permissions = json_decode($cookie, true);
}