#27818 [Com]: session_destroy doesn't work

From: Date: Mon, 12 Apr 2004 18:28:00 +0000
Subject: #27818 [Com]: session_destroy doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-57955@lists.php.net to get a copy of this message
ID: 27818 Comment by: alan dot warden at btinternet dot com Reported By: ezdevelop at hotmail dot com Status: Suspended Bug Type: Session related Operating System: win2000 adv server PHP Version: 5.0.0RC1 New Comment: The behaviour is the same if the session is started when php start by settin session.auto_start = 1 Previous Comments: ------------------------------------------------------------------------ [2004-04-01 02:14:15] derick@php.net 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. ------------------------------------------------------------------------ [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 (#57955) next »