Today I installed PHP8 and tried it with our CodeIgniter 3 project.
I found 2 issues:
1) We had a controller class called Attribute which it doesn't like. Perhaps this is a reserved word in PHP8.
2) More serious - flash data doesn't seem to clear. Once you have a piece of flash data set, for example "Your changes were saved", it continues to persist on every page load thereafter. I tracked this down to \system\libraries\Session\Session.php Lines 418 to 423:
Code:
// Hacky, but 'old' will (implicitly) always be less than time() ;)
// DO NOT move this above the 'new' check!
elseif ($value < $current_time)
{
unset($_SESSION[$key], $_SESSION['__ci_vars'][$key]);
}
Looks like in PHP7 "old" was < time(), whereas in PHP 8 it isn't. I propose changing this to:
Code:
// Hacky, but 'old' will (implicitly) always be less than time() ;)
// DO NOT move this above the 'new' check!
elseif ($value === 'old' || $value < $current_time)
{
unset($_SESSION[$key], $_SESSION['__ci_vars'][$key]);
}