Welcome Guest, Not a member yet? Register   Sign In
Turn off CI4 Session handling in v4.5.1 ?
#1

(This post was last modified: 06-04-2024, 12:24 AM by codeus.)

Hello,
CI project was on v4.3, recently upgraded to v4.5.1.

Now Session settings are in new config file Session.php, it does not appear to be possible to turn off CI Session handling. In my BaseController, a session is created (outside of CI4), and the error below appears, because my session has indeed already been started.

There appears to be nothing in CI docs about disabling CI Session handling. Is it possible to disable now?

TIA
Mike

PHP: 8.2.19 — CodeIgniter: 4.5.1 -- Environment: development

Code:
ErrorException
ini_set(): Session ini settings cannot be changed when a session is active
SYSTEMPATH/Session/Handlers/FileHandler.php at line 74

Code:
67
68     public function __construct(SessionConfig $config, string $ipAddress)
69     {
70         parent::__construct($config, $ipAddress);
71
72         if (! empty($this->savePath)) {
73             $this->savePath = rtrim($this->savePath, '/\\');
74             ini_set('session.save_path', $this->savePath);
75         } else {
76             $sessionPath = rtrim(ini_get('session.save_path'), '/\\');
77
78             if ($sessionPath === '') {
79                 $sessionPath = WRITEPATH . 'session';
80             }
Reply
#2

(This post was last modified: 06-04-2024, 09:33 AM by codeus.)

After reading the userguide (excerpt below), I believe this is a bug-:

Quote:This was due to the specifics of how sessions worked, but is now no longer necessary with our new implementation. However, it may happen that your application relied on these values, so here are alternative methods of accessing them:

session_id: $session->session_id or session_id() (PHP’s built-in function)


Before v4.3.0, the session configuration was held in Config/App.php. Now Config/Session.php holds the session configuration. There is nothing in Config/Session.php to indicate how to turn off CI session handling. Looking at the CI code appears to confirm this.

Marking this as solved, as a post has been made in Issues
https://forum.codeigniter.com/showthread...#pid419294
Reply




Theme © iAndrew 2016 - Forum software by © MyBB