#45719 [Opn]: session_destroy behaviour documentation incomplete (or unclear)

From: Date: Tue, 05 Aug 2008 10:21:20 +0000
Subject: #45719 [Opn]: session_destroy behaviour documentation incomplete (or unclear)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1062@lists.php.net to get a copy of this message
ID: 45719 User updated by: markvanstraten at gmail dot com -Summary: session_destroy behaviour documented incomplete Reported By: markvanstraten at gmail dot com Status: Open Bug Type: Documentation problem Operating System: Windows XP PHP Version: Irrelevant New Comment: changed title to be more descriptive Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#1062) next »