Doc #27555 [Com]: Unable to modify $_SESSION from __destruct()

From: Date: Sat, 08 Aug 2015 11:51:01 +0000
Subject: Doc #27555 [Com]: Unable to modify $_SESSION from __destruct()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12593@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=27555&edit=1 ID: 27555 Comment by: sebikeller at myfucking dot email Reported by: jaanus at heeringson dot com Summary: Unable to modify $_SESSION from __destruct() Status: No Feedback Type: Documentation Problem Package: Documentation problem Operating System: Linux 2.4.24 PHP Version: 5CVS-2004-03-10 (dev) Assigned To: helly Block user comment: N Private report: N New Comment: Seems like function registered via register_shutdown_function gets called before __destruct most of the time. Works only if you destroy your object before the registered function gets called… Previous Comments: ------------------------------------------------------------------------ [2015-08-08 10:19:51] sebikeller at myfucking dot email Simple, **but annoying** workaround: register_shutdown_function(function(){ session_write_close(); }); ------------------------------------------------------------------------ [2012-07-07 01:37:58] jonimane at gmail dot com I have the same problem. I am trying to set an SESSION variable in a destructor method, but it didnt work. And what about feedback? ------------------------------------------------------------------------ [2010-05-29 23:40:16] acetox94 at gmx dot de What about destroying the object with unset? This should call the __destruct()-Function before the session ends.. ------------------------------------------------------------------------ [2010-04-03 16:49:42] bjoern at heyser dot ac I'am also interested in infomation to the issue. I use php 5.2 an run into the same issues when I write a session wrapper class. Will the "(unwanted) feature" becomes removed or is there any sense for calling destructors after php modules are shutdown.. A further issue I think is the current working directory that isn't available in destructors as well as in custom registered shutdown functions. best regards, björn (sorry for my english) ------------------------------------------------------------------------ [2009-10-20 19:44:34] gabriel at gabrielharrison dot co dot uk Hi, I can not find anything in the documentation about this. Was it added or was the feature changed in newer versions? Thanks, Gabriel ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=27555 -- Edit this bug report at https://bugs.php.net/bug.php?id=27555&edit=1

« previous php.doc.bugs (#12593) next »