yii: session_regenerate_id(): Session object destruction failed

When I am trying to log-in after logging off, I getting such WARNING: D:\work\localhost\yii-1.1.13\framework\web\CHttpSession.php(185)

This WARNING appears randomly.

183     public function regenerateID($deleteOldSession=false)
184     {
185         session_regenerate_id($deleteOldSession);
186     }

If I add check to code:

183     public function regenerateID($deleteOldSession=false)
184     {
185         if (session_status() != PHP_SESSION_ACTIVE)
186           session_regenerate_id($deleteOldSession);
187     }

Then the problem (warning) disappears.

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@samdark Yes, the problem has been solved by introducing own customized class:

class HttpSession extends CHttpSession
{
    public function regenerateID($deleteOldSession = false)
    {
        if(session_id() === '') session_regenerate_id($deleteOldSession);
    }
}

and changing configuration:

'session'=>array
(
    'class'=>'HttpSession'
),

The exception is no longer thrown. However, I have noticed a very strange behavior (again under IE only), after applying this fix. I’ll report in separate comment below, to not mix two things.