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] [EMAIL PROTECTED]
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