set("PHPSESSID", session_create_id" /> set("PHPSESSID", session_create_id" /> set("PHPSESSID", session_create_id"/>

How to change phpsessid after login using symfony 3.4

1.4k Views Asked by At

I'd like to use different session id (PHPSESSID value) before and after login to the system:

$this->get("session")->set("PHPSESSID", session_create_id());

but after doing that cannot log onto system.

I found a solution here but I don't have security.xml file: Symfony 3 - How to keep session id after logging in?

Any solutions will be appreciated.

1

There are 1 best solutions below

0
Thakkie On BEST ANSWER

You can use

$this->get("session")->migrate();

It should create a new session identical to the current session.

More info here http://symfony.com/doc/3.4/components/http_foundation/sessions.html