[Session] Session IDs do not match |
Suppose I have the following code:
PHP Code: $session = session(); DEBUG - 2020-09-05 12:34:36 --> Session ID: 528172rok6phf1ttgu9ucvl3f4pkcqjj DEBUG - 2020-09-05 12:34:36 --> Session array: array ( '__ci_last_regenerate' => 1599302009, 'user_language' => 'de', '_ci_previous_url' =>'http://.....', ) DEBUG - 2020-09-05 12:34:36 --> Session: CodeIgniter\Session\Session::__set_state(array( 'driver' => CodeIgniter\Session\Handlers\FileHandler::__set_state(array( 'savePath' => '...', 'fileHandle' => NULL, 'filePath' => '...', 'fileNew' => false, 'matchIP' => false, 'fingerprint' => 'd41d8cd98f00b204e9800998ecf8427e', 'lock' => false, 'cookiePrefix' => '', 'cookieDomain' => '', 'cookiePath' => '/', 'cookieSecure' => false, 'cookieName' => 'ci_session', 'sessionID' => '4gtbbgdn3ig0kcu7ejhee49jil9mhujk', The lower session ID (sessionID 4gt...) seems to be an older session ID. Does anybody know why I get two different session IDs? After the next call the IDs match.
It could be because cookies do not update until a page refresh has happened.
Refresh the page first then see what you get. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-06-2020, 03:02 AM)InsiteFX Wrote: It could be because cookies do not update until a page refresh has happened.No, this was not the case. The reason was that the request sent two cookies with the same name "ci_session". And it seems to be that the two statements got their IDs from different cookies. PS: I did not know that this is possible. Took me a while to find it out.
First that I have ever heard of this happening like that.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-07-2020, 12:30 PM)InsiteFX Wrote: First that I have ever heard of this happening like that.Yep, I did also not imagine this. This was the scenario: First request was sent to "www.example.com/...". CodeIgniter redirected the request to "example.com/..." via redirect()->to(). By doing so two different cookies were generated with the same name(!) but one for www.example.com and the other one for example.com. The next request submitted both cookies and the mess started... |
Welcome Guest, Not a member yet? Register Sign In |