1 session.inc _backdrop_session_destroy($sid)

Session handler assigned by session_set_save_handler().

Cleans up a specific session.


$sid: Session ID.

Return value

TRUE: The session destroy handler must always return TRUE.


core/includes/session.inc, line 457
User session handling functions.


function _backdrop_session_destroy($sid) {
  global $user, $is_https;

  // Nothing to do if we are not allowed to change the session.
  if (!backdrop_save_session()) {
    return TRUE;

  // Delete session data.
    ->condition($is_https ? 'ssid' : 'sid', $sid)

  // Reset $_SESSION and $user to prevent a new session from being started
  // in backdrop_session_commit().
  $_SESSION = array();
  $user = backdrop_anonymous_user();

  // Unset the session cookies.
  if ($is_https) {
    _backdrop_session_delete_cookie(substr(session_name(), 1), FALSE);
  elseif (settings_get('https', FALSE)) {
    _backdrop_session_delete_cookie('S' . session_name(), TRUE);
  return TRUE;