#29032 [Com]: Session are closed before all object destructors executed.

From: Date: Sun, 18 Sep 2005 09:21:48 +0000
Subject: #29032 [Com]: Session are closed before all object destructors executed.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85201@lists.php.net to get a copy of this message
ID: 29032 Comment by: jasper at bryant-greene dot name Reported By: antonr at game dot permonline dot ru Status: No Feedback Bug Type: Session related Operating System: Irrelevant PHP Version: 5CVS-2004-07-06 (dev) New Comment: PLEASE FIX THIS BUG This is a serious show-stopper bug that is starting to make me want to stop using PHP. It has been annoying me for a while now, and I (and many others) would love to see it fixed. Previous Comments: ------------------------------------------------------------------------ [2005-04-10 21:40:16] spam at cimmanon dot org This bug still persists in PHP 5.0.4 (my problem is related to output buffers being cleared before destructors are executed). Is the "latest CVS snapshot" mentioned by sniper@php.net [6 Mar 8:35pm CET] reflected in the 5.0.4 release [31 Mar]? ------------------------------------------------------------------------ [2005-03-14 01:00:10] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-03-06 20:35:59] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2004-12-06 05:34:29] anthony at ectrolinux dot com For reference, this bug appears to be synonymous to bug #30578, with the same cause but a different effect. ------------------------------------------------------------------------ [2004-10-26 02:40:15] auroraeosrose at hotmail dot com Modifying $_SESSION in the destructor ONLY works if you call unset($object) before the end of your script, however this is a pain in the rear - and if you have references to that object elsewhere it doesn't work properly. There is a workaround... You CAN use register_shutdown_function in the constructor of your class public function __construct() { register_shutdown_function(array($this, '__destruct'); } and then the destruct is called early enough that you can modify $_SESSION. But this defeats the whole purpose of a destructor - I could do that in every class if php5 didn't support destructors (in fact I did in php4) but I thought the point was to eliminate messy workarounds. Now why in the world the sessions are closed in between when shutdown functions and destructors are called is beyond me. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/29032 -- Edit this bug report at http://bugs.php.net/?id=29032&edit=1

« previous php.bugs (#85201) next »