#45719 [Opn->Csd]: session_destroy behaviour documentation incomplete (or unclear)
| From: | vrana@php.net | Date: | Wed, 05 Nov 2008 10:26:17 +0000 |
| Subject: | #45719 [Opn->Csd]: session_destroy behaviour documentation incomplete (or unclear) | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-1348@lists.php.net to get a copy of this message | ||
ID: 45719
Updated by: vrana@php.net
Reported By: markvanstraten at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Windows XP
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"To use the session variables again, session_start() has to be called."
Previous Comments:
------------------------------------------------------------------------
[2008-08-05 10:21:20] markvanstraten at gmail dot com
changed title to be more descriptive
------------------------------------------------------------------------
[2008-08-05 10:18:44] markvanstraten at gmail dot com
Description:
------------
session_destroy() does not only unset the values in the session but
disables the session completely, untill another call to session_start()
is issued.
This is not documented behaviour and should be. It will save people som
e time. It is mentioned in the user comments but way down the line, not
the first place to search for the description of behaviour.
Reproduce code:
---------------
<?php
session_start();
echo 'current id is ',session_id(),PHP_EOL;
//set value in session
$_SESSION['foo'] = 'bar';
echo 'value set in session, current content:',PHP_EOL;
print_r($_SESSION);
//destroy session content
session_destroy();
echo 'session destroyed, current content: ',PHP_EOL;
print_r($_SESSION);
echo 'current id is ',session_id(),PHP_EOL;
//regenerate ID?
session_regenerate_id();
echo 'regenerated id',PHP_EOL;
echo 'current id is ',session_id(),PHP_EOL;
//start new session?
session_start();
echo 'started new session',PHP_EOL;
echo 'current id is ',session_id(),PHP_EOL;
//regenerate ID?
session_regenerate_id();
echo 'regenerated id',PHP_EOL;
echo 'current id is ',session_id(),PHP_EOL;
?>
Expected result:
----------------
I would have expected that session_destroy() would only affect the
current values of the session.
Possibly, i had expected that session_regenerate_id() would (under the
surface) call session_start() for me if not already available.
Actual result:
--------------
session_destroy() destroy's the session with the values and the
session_id
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45719&edit=1