Jump to content

Why Did Session Object Destruction Failed ?


Go to solution Solved by requinix,

Recommended Posts

Hi All,
A few weeks ago, as part of a logout process, I implemented Jacques1's "Terminating the session correctly" procedure (https://forums.phpfreaks.com/topic/287744-secure-login-strongest-session-ids-and-secure-site-navigation/).
Anytime I used it, it worked perfectly. But today I once got the warning "Session object destruction failed in .... on line XX", "XX" being the line for "session_destroy();".
Since then, I tried to reproduce the error, but the logout process works again as expected.
1. Any idea of the reason for this "single" failure ?
2. Would inserting "session_regenerate_id();" before "session_destroy();" really be a solution, as suggested here?
Thanks !

  • Solution

It happens when the session data could not be deleted. You're probably using regular session files, so that means the file couldn't be deleted: it may have been already (somehow), or maybe permissions were messed up, or perhaps the file was locked because PHP was still using it (I don't know about that one).

 

Adding session_regenerate_id() will only cover up the problem by switching the session ID to something else just before you delete it. Extra work for no gain.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.