0

Why does changing/making errors in one's codebase sometimes destroy a session in Codeigniter/PHP? I can't figure out the logic of why this is happening sometimes and not others and its driving me nuts.

I'm wondering what the triggers are for calling sess_destroy(). Can a session only be destroyed if my script contains code that writes data to the session? I guess what i'm trying to figure out is whether there are redirect scripts baked into codeigniter/php to destroy a session upon parse errors even if I haven't explictly made calls to update the session data

thanks,

tim

4

1 回答 1

1

If you make some change in your code that result in parse error or other type of fatal error then it's possible that php cannot write data to session - because script dies before the php calls session_write(), which php usually does automatically at the end of script.

So if php never gets a chance to call session_write() you session data is lost.

You should check your php error log to see if you have any fatal errors, find the source of them and fix your script.

于 2012-04-04T13:36:35.470 回答