lonnieezell / Bonfire2

CodeIgniter 4-based application skeleton
MIT License
131 stars 50 forks source link

Cookie bf_consent does not initially exist #126

Closed robertkendrick closed 2 years ago

robertkendrick commented 2 years ago

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 2 years ago

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

robertkendrick commented 2 years ago

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 2 years ago

My apologies. I don't checked before answer. You are right: https://github.com/codeigniter4/CodeIgniter4/pull/4883

atsanna commented 2 years ago

I solved it this way:

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