#27818 [Opn->Sus]: session_destroy doesn't work

From: Date: Thu, 01 Apr 2004 07:14:16 +0000
Subject: #27818 [Opn->Sus]: session_destroy doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-57294@lists.php.net to get a copy of this message
ID: 27818 Updated by: derick@php.net Reported By: ezdevelop at hotmail dot com -Status: Open +Status: Suspended Bug Type: Session related Operating System: win2000 adv server PHP Version: 5.0.0RC1 New Comment: This is actually expected behavior, as the session is already automatically closed before destructors are run. There is some trickery in the engine now that perhaps makes it possible to "fix" this, but we'll suspend this for now. Previous Comments: ------------------------------------------------------------------------ [2004-03-31 20:15:03] ezdevelop at hotmail dot com Description: ------------ When I'm trying to use session_destroy() functioni n the __destruct() function, PHP says: "Warning: Trying to destroy uninitialized session" I'v tested the code under Apache and IIS, but all the same mistake. Reproduce code: --------------- <?php class test { function __construct() { echo 'Initialize the session.'; session_start(); } function __destruct() { session_destroy(); echo 'Finally, destroy the session.'; } } $test = new test(); ?> Expected result: ---------------- Initialize the session. Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in D:\wwwroot\sess.php on line 10 Finally, destroy the session. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27818&edit=1

« previous php.bugs (#57294) next »