[Solar-talk] Re-introducing Solar_Session with adapter support

Antti Holvikari anttih at gmail.com
Sat Mar 1 19:10:30 CST 2008


On Sun, Mar 2, 2008 at 3:01 AM, Antti Holvikari <anttih at gmail.com> wrote:
> On Sun, Mar 2, 2008 at 2:46 AM, Antti Holvikari <anttih at gmail.com> wrote:
>  > On Sun, Mar 2, 2008 at 12:29 AM, Leo Chiao <leo.chiao at gmail.com> wrote:
>
> >  > You may want to also add session_write_close() via a __destruct or using
>  >  > register_shutdown_function for the db backed sessions
>  >
>  >  The only time when write() didn't get called for me was when I
>  >  redirected via header('Location: bah'). Solar calls
>  >  session_write_close() within Solar_Controller_Page::redirect(), so
>  >  that problem is at least somewhat solved there. Do you know of other
>  >  situations where write() would not get called by PHP? I mean, PHP
>  >  *should* almost always call write() when it shuts down, right? If
>  >  _destruct() gets called, why wouldn't write() get called right after
>  >  that?
>
>  Ok, I think I get it. We need to write session data before all objects
>  are gone. It seems to me that calling session_write_close in
>  __destruct() would be enough. Any comments?
>
>  Via: http://www.rooftopsolutions.nl/article/160

Sorry for the spam but now that I think about it, __destruct() could
get called too early if you don't use the object at all. Thus,
registering session_write_close as a shutdown function seems like the
way to go.


-- 
Antti Holvikari <http://anttih.com>


More information about the Solar-talk mailing list