From 0b347f3a999fd8e0e8f7961c991b1b25ed0b1b4a Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Sat, 11 Nov 2006 22:41:20 +0000 Subject: [PATCH] #93945 by chx. Save sessions before objects are destroyed on some configurations. --- includes/session.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/session.inc b/includes/session.inc index e18845ae45b..4c61bb6374b 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -17,6 +17,11 @@ function sess_close() { function sess_read($key) { global $user; + // Write and Close handlers are called after destructing objects since PHP 5.0.5 + // Thus destructors can use sessions but session handler can't use objects. + // So we are moving session closure before destructing objects. + register_shutdown_function('session_write_close'); + // Handle the case of first time visitors and clients that don't store cookies (eg. web crawlers). if (!isset($_COOKIE[session_name()])) { $user = drupal_anonymous_user();