lonnieezell / Bonfire2

CodeIgniter 4-based application skeleton

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cookie bf_consent does not initially exist

robertkendrick opened this issue · comments

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

I believe even ci4 doesn't support version 8.1.x at the moment. Bonfire2 "follows" him on this subject.

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.

My apologies. I don't checked before answer. You are right: codeigniter4/CodeIgniter4#4883

I solved it this way:

        $cookie      = get_cookie('bf_consent');
        if($cookie!=null) {
           $permissions = json_decode($cookie, true);
        }