diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-01 09:39:27 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-01 09:39:27 +0000 |
commit | e26ef638ee3fee9c8eddd5c7ce6fcefa7f883bed (patch) | |
tree | 1d4bd2e4228db555ec114823b1536895179a104a | |
parent | a0ae940483650283926aea5c1b73aa325849f2fe (diff) | |
download | brdo-e26ef638ee3fee9c8eddd5c7ce6fcefa7f883bed.tar.gz brdo-e26ef638ee3fee9c8eddd5c7ce6fcefa7f883bed.tar.bz2 |
#178999 by sammys: register header(Location) as a shutdown function in drupal_goto() so the redirection takes place after the session data was written to the database
-rw-r--r-- | includes/common.inc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/includes/common.inc b/includes/common.inc index 299924c93..40efc961a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -306,11 +306,13 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response // Before the redirect, allow modules to react to the end of the page request. module_invoke_all('exit', $url); - header('Location: '. $url, TRUE, $http_response_code); - - // The "Location" header sends a REDIRECT status code to the http - // daemon. In some cases this can go wrong, so we make sure none - // of the code below the drupal_goto() call gets executed when we redirect. + // Here we register header() to be called after exit(). Because + // session_write_close() was registered before header() all session + // data will be written to the database before the header is sent to the + // browser. + register_shutdown_function('header', "Location: $url", TRUE, $http_response_code); + + // Make sure none of the code below the drupal_goto() call gets executed. exit(); } |