79665015

Date: 2025-06-13 14:55:15
Score: 0.5
Natty:
Report link

I’ve worked on similar hybrid setups during migrations — especially between Symfony versions — and this kind of session management conflict is pretty common.

Is there a proper way to tell Symfony 6 to not start a session but use the existing one?


// In a Symfony 6 controller or service
$session = $request->getSession();
if ($session->isStarted()) {
    // Access session safely without triggering session_start()
    $userId = $session->get('user_id');
}

But to avoid starting the session, you must:

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: LeoHarada