function drupal_session_start

Forcefully starts a session, preserving already set session data.

Related topics

4 calls to drupal_session_start()
drupal_session_commit in drupal/core/includes/session.inc
Commits the current session, if necessary.
drupal_session_initialize in drupal/core/includes/session.inc
Initializes the session handler, starting a session if needed.
drupal_session_regenerate in drupal/core/includes/session.inc
Called when an anonymous user becomes authenticated or vice-versa.
update.php in drupal/core/update.php
Administrative page for handling updates from one Drupal version to another.

File

drupal/core/includes/session.inc, line 277
User session handling functions.

Code

function drupal_session_start() {

  // Command line clients do not support cookies nor sessions.
  if (!drupal_session_started() && !drupal_is_cli()) {

    // 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;
    }
  }
}