$this->session->sess_destroy(); error |
A PHP Error was encountered
Severity: Warning Message: session_destroy(): Trying to destroy uninitialized session Filename: Session/Session.php Line Number: 627 http://stackoverflow.com/questions/57528...on-destroy If you need to just delete the session if it exists (for example in an auto called exit/logout/destructor script) and it may or may not exist, then you can use session_status to check the status. As of PHP 5.4.0, you can check it like this: if(session_status() == PHP_SESSION_ACTIVE) { session_destroy(); } This is preferable to creating a new section just to destroy it later. Per the PHP manual, session_status will return an integer that can be compared with the following constants: Return Values • PHP_SESSION_DISABLED - Returned if sessions are disabled. • PHP_SESSION_NONE - Returned if sessions are enabled, but none exists. • PHP_SESSION_ACTIVE - Returned if sessions are enabled, and one exists. This allows you to write better, more efficient, and more flexible session management code. |
Messages In This Thread |
$this->session->sess_destroy(); error - by chaegumi - 04-04-2016, 11:30 PM
RE: $this->session->sess_destroy(); error - by projack89 - 04-05-2016, 01:58 AM
RE: $this->session->sess_destroy(); error - by chaegumi - 04-05-2016, 02:37 AM
RE: $this->session->sess_destroy(); error - by josepostiga - 04-05-2016, 03:01 AM
RE: $this->session->sess_destroy(); error - by Narf - 04-05-2016, 05:00 AM
RE: $this->session->sess_destroy(); error - by josepostiga - 04-05-2016, 05:15 AM
RE: $this->session->sess_destroy(); error - by Narf - 04-05-2016, 05:50 AM
RE: $this->session->sess_destroy(); error - by josepostiga - 04-05-2016, 06:11 AM
RE: $this->session->sess_destroy(); error - by albertleao - 04-05-2016, 03:32 PM
RE: $this->session->sess_destroy(); error - by josepostiga - 04-05-2016, 04:09 PM
RE: $this->session->sess_destroy(); error - by Narf - 04-05-2016, 06:48 AM
RE: $this->session->sess_destroy(); error - by JuliaV - 04-25-2016, 12:28 AM
|