title: CodeIgniter strange behaviour with sess_destroy
body: <p>What is wrong in this code? </p>
  
  <p>The session variable "user" has the id of the user logged. It's set on login process.</p>
  
  <pre><code>$this-&gt;session-&gt;set_userdata("user",$user-&gt;id);
  </code></pre>
  
  <p>This code always show the error page and perform the session destroy!!!why?</p>
  
  <pre><code>if ( !$this-&gt;session-&gt;userdata("user"))
  {
     $error = "User do logout without been logged [" . $_SERVER['REMOTE_ADDR'] ."]" ;
     log_message('error', $error);
     show_error($error);
  }
  else
  {
      $this-&gt;session-&gt;sess_destroy();
  }
  </code></pre>
  
  <p>If I comment <strong>$this->session->sess_destroy()</strong>  it works, the session is not destroy and the error is not shown</p>