summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-10-24 15:31:35 +0000
committerDries Buytaert <dries@buytaert.net>2006-10-24 15:31:35 +0000
commitd638d8bc03862c424969c0c8bcd104609ee96fe6 (patch)
tree1d20ecc67a05b2a44dcf1b3aa7e89d6a82516cb1
parent35f906eb0a82803f8052bfede3b8396337767233 (diff)
downloadbrdo-d638d8bc03862c424969c0c8bcd104609ee96fe6.tar.gz
brdo-d638d8bc03862c424969c0c8bcd104609ee96fe6.tar.bz2
- Patch #87372 by crunchywelch: work around PHP session bug.
-rw-r--r--includes/session.inc12
1 files changed, 11 insertions, 1 deletions
diff --git a/includes/session.inc b/includes/session.inc
index 17815eeb9..4c939ccac 100644
--- a/includes/session.inc
+++ b/includes/session.inc
@@ -85,6 +85,16 @@ function sess_write($key, $value) {
function sess_regenerate() {
$old_session_id = session_id();
session_regenerate_id();
+
+ // We code around http://bugs.php.net/bug.php?id=32802 by destroying
+ // the session cookie by setting expiration in the past (a negative
+ // value). This issue only arises in PHP versions before 4.4.0,
+ // regardless of the Drupal configuration.
+ // TODO: remove this when we require at least PHP 4.4.0
+ if (isset($_COOKIE[session_name()])) {
+ setcookie(session_name(), '', time() - 42000, '/');
+ }
+
db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
}
@@ -127,4 +137,4 @@ function sess_gc($lifetime) {
db_query("DELETE FROM {sessions} WHERE timestamp < %d", time() - $lifetime);
return TRUE;
-} \ No newline at end of file
+}