I'm getting the following error with CI4. Note that the site I'm dealing with is a combination of pure php and CI. I also only have 1 page in CI4, as I'm just starting to 'migrate' to it.
Code:
ErrorException
ini_set(): A session is active. You cannot change the session module's ini settings at this time
SYSTEMPATH/Session/Handlers/FileHandler.php at line 319
319 ini_set('session.sid_length', (string) $SIDLength);
Backtrace:
1. {PHP internal code} — CodeIgniter\Debug\Exceptions->errorHandler ( arguments )
2. SYSTEMPATH/Session/Handlers/FileHandler.php : 319 — ini_set()
3. SYSTEMPATH/Session/Handlers/FileHandler.php : 83 — CodeIgniter\Session\Handlers\FileHandler->configureSessionIDRegex ()
4. SYSTEMPATH/Config/Services.php : 686 — CodeIgniter\Session\Handlers\FileHandler->__construct ( arguments )
5. SYSTEMPATH/Config/BaseService.php : 258 — CodeIgniter\Config\Services::session ( arguments )
6. SYSTEMPATH/Config/BaseService.php : 199 — CodeIgniter\Config\BaseService::__callStatic ( arguments )
7. SYSTEMPATH/Config/Services.php : 664 — CodeIgniter\Config\BaseService::getSharedInstance ( arguments )
8. SYSTEMPATH/Config/BaseService.php : 258 — CodeIgniter\Config\Services::session ()
9. SYSTEMPATH/Common.php : 996 — CodeIgniter\Config\BaseService::__callStatic ( arguments )
10. SYSTEMPATH/CodeIgniter.php : 1069 — session()
11. SYSTEMPATH/CodeIgniter.php : 549 — CodeIgniter\CodeIgniter->storePreviousURL ( arguments )
12. SYSTEMPATH/CodeIgniter.php : 361 — CodeIgniter\CodeIgniter->handleRequest ( arguments )
13. FCPATH/index.php : 114 — CodeIgniter\CodeIgniter->run ()
To simplify things, essentially what I'm running into is that my controller loads my header helper where, among other things, I check if the session is valid (ie. user is logged in), which needs to call session_start() to check variables. Anyway, because of this, the page fails to load. If I place an "exit();" at the bottom of my view page, it will load just fine. If I let it go through as normal, it will fail with the above. As a workaround, I can add the '@' in front of 'ini_set()' to disable errors, but I'd like to figure out how to fix it properly.
I figure I'm either doing something wrong, or I found a potential bug, but I'd bet on the former...
Anyone have any thoughts on what I should do to fix this?