CodeIgniter Forums
How can I resume the session? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: How can I resume the session? (/showthread.php?tid=74694)



How can I resume the session? - Navindex - 10-26-2019

I'm using session data to save and restore multi-page form data in CI4 (rc3). PHP version is 7.2.24.

It works very well when I use the conventional PHP-way with $_SESSION and session_start().
However, when I try to do the same with CI4, it creates a new session instead of resuming the existing one.

The environment settings are:

Code:
app.sessionDriver             = 'CodeIgniter\Session\Handlers\FileHandler'
app.sessionCookieName         = 'my_session_cookie_'
app.sessionExpiration         = 7200
app.sessionMatchIP            = false
app.sessionTimeToUpdate       = 300
app.sessionRegenerateDestroy  = false

This happens every time when I initialize the session ( $session = session(); ) on a new page. I would expect it resumes the existing session, however, a new cookie is created.

Quote:my_session_cookie_9u6ahqoi6i3io93g1gtmekpegcou0gml
my_session_cookie_aom9vnrvjjpkn12l1hl7j3a716ing9sf
my_session_cookie_hvm0gcvjd7i7avu64aksv8udn25fcsio
my_session_cookie_ra9qb2kqp40psju6up7ff13tflsbgvfq
my_session_cookie_v0g6g81g71vrja5cb63cglue7j0shrj2

These files contain session data of a single page only.

Is this a bug or I'm missing something here? When I switch back to PHP's session_start(), it resumes the session correctly.