note 57001 deleted from function.session-set-save-handler by drak
| From: | drak@php.net | Date: | Sun, 11 Mar 2012 02:19:53 +0000 |
| Subject: | note 57001 deleted from function.session-set-save-handler by drak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186583@lists.php.net to get a copy of this message | ||
Note Submitter: rudy dot metzger at pareto dot nl
----
NOTE: as from php-5.0.5, objects are destroyed BEFORE the session_write() is called! So if you use
an object as custom session handler, your writes will fail, as at the moment of write the object is
already destroyed. A workaround for this is to use session_write_close() in the __destruct() of the
object. This however only works if you do not need any other objectes, as these already might be
gone! I only hope that object are destroyed in "descening" order, as if you would have a
DB object in the session handler object which handles the DB connects, you would have to use
__destruct() also in this object. otherwise your session object is still alive but your DB is long
gone...
I raised a bug for this already but it is claimed that this is no bug.
This only applies to versions 5.0.5 (and possibly higher)