You are here

function drupal_session_start in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 modules/memcache/unstable/memcache-session.inc \drupal_session_start()

Forcefully start a session, preserving already set session data.

Related topics

3 calls to drupal_session_start()
drupal_session_commit in modules/memcache/unstable/memcache-session.inc
Commit the current session, if necessary.
drupal_session_initialize in modules/memcache/unstable/memcache-session.inc
Initialize the session handler, starting a session if needed.
drupal_session_regenerate in modules/memcache/unstable/memcache-session.inc
Called when an anonymous user becomes authenticated or vice-versa.

File

modules/memcache/unstable/memcache-session.inc, line 207

Code

function drupal_session_start() {
  if (!drupal_session_started()) {

    // Save current session data before starting it, as PHP will destroy it.
    $session_data = isset($_SESSION) ? $_SESSION : NULL;
    session_start();
    drupal_session_started(TRUE);

    // Restore session data.
    if (!empty($session_data)) {
      $_SESSION += $session_data;
    }
  }
}