Problem/Motivation
On PHP 7.3, session regeneration fails when logging in if an anonymous session was already active. A warning is thrown in drupal_session_regenerate(), line 375 of includes/session.inc: session_id(): Cannot change session id when session is active.
Proposed resolution
The original D8 fix is here: #2989734: PHP 7.3 compatibility . This patch resolves the issue on Drupal 7 in an analogous way by closing the old session (without saving it, so there is not even a split second with the old session ID and new user ID in the session store), regenerating the session ID, starting a new session, restoring the global user object, and finally re-enabling session saving.