function drupal_save_session

Determines whether to save session data of the current request.

This function allows the caller to temporarily disable writing of session data, should the request end while performing potentially dangerous operations, such as manipulating the global $user object. See http://drupal.org/node/218104 for usage.

Parameters

$status: Disables writing of session data when FALSE, (re-)enables writing when TRUE.

Return value

FALSE if writing session data has been disabled. Otherwise, TRUE.

17 calls to drupal_save_session()
DrupalRenderTestCase::testDrupalRenderCache in modules/simpletest/tests/common.test
Tests caching of render items.
DrupalWebTestCase::setUp in modules/simpletest/drupal_web_test_case.php
Sets up a Drupal site for running functional and integration tests.
DrupalWebTestCase::tearDown in modules/simpletest/drupal_web_test_case.php
Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix.
drupal_cron_run in includes/common.inc
Executes a cron run when called.
drupal_session_commit in includes/session.inc
Commits the current session, if necessary.

... See full list

File

includes/session.inc, line 594

Code

function drupal_save_session($status = NULL) {
    // PHP session ID, session, and cookie handling happens in the global scope.
    // This value has to persist across calls to drupal_static_reset(), since a
    // potentially wrong or disallowed session would be written otherwise.
    static $save_session = TRUE;
    if (isset($status)) {
        $save_session = $status;
    }
    return $save_session;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.