Had to add `session_id()` check because, for some reason, CLI scripts can use sessions and in that case session is forced to start. However, Symfony does not handle sessions in CLI (which seems to be normal), so session is never started.
This avoids a warning when doing the `session_destroy()` below.