|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-19 04:01 UTC] gearb0x at eml dot cc
Description:
------------
For some reason unseting session variables is stopping php from saving any session variables. The code below should clear the session but it isnt, this code worked fine on 5.1.2 on a freeBSD box. Also ive noticed that if i make any changes to the session variables (ie: adding new ones) they dont get saved in the session either
Reproduce code:
---------------
<?php
session_start();
foreach($_SESSION as $key=>$value)
{
unset($_SESSION[$key]);
}
?>
Expected result:
----------------
This should clear the session. Also, any other changes made to the session arent saved either (ie: creating more session variables
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 22:00:01 2025 UTC |
I've tried to replicate the described problem however the code appears to work properly. I've made 3 scripts: A: session_start(); $_SESSION['A'] = 1; $_SESSION['B'] = 'afdsf'; B: session_start(); foreach($_SESSION as $key=>$value) { unset($_SESSION[$key]); } C: session_start(); var_dump($_SESSION, session_id()); The code shows that the unset loop is in fact successful in clearing out & saving session data.