#45719 [NEW]: session_destroy behaviour documented incomplete
| From: | markvanstraten at gmail dot com | Date: | Tue, 05 Aug 2008 10:18:44 +0000 |
| Subject: | #45719 [NEW]: session_destroy behaviour documented incomplete | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-1061@lists.php.net to get a copy of this message | ||
From: markvanstraten at gmail dot com
Operating system: Windows XP
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: session_destroy behaviour documented incomplete
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 bug report at http://bugs.php.net/?id=45719&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45719&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45719&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45719&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45719&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45719&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45719&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45719&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45719&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45719&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45719&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45719&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45719&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45719&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45719&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45719&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45719&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45719&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45719&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45719&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45719&r=mysqlcfg