note 57001 added to function.session-set-save-handler

From: Date: Wed, 21 Sep 2005 13:18:26 +0000
Subject: note 57001 added to function.session-set-save-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-95529@lists.php.net to get a copy of this message
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) ---- Manual Page -- http://www.php.net/manual/en/function.session-set-save-handler.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57001 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57001&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57001&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95529) next »