#19176 [Opn->Bgs]: The unset() function in the $_SESSION variable seems to work, but it doesn't !!
ID: 19176
Updated by: sander@php.net
Reported By: papejack@hotmail.com
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Linux
PHP Version: 4.2.2
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-08-29 14:06:16] papejack@hotmail.com
Here we go: the unset function doesn't work for $_SESSION on
Linux/Apache/PHP4.2.2. The function seems to work in the current file,
but when you reload or go in another PHP page, then you clearly see
that it didn't work.
On the other hand, it work perfectly when running PHP4.2.2 on Windows
XP/IIS 5.1.
Here is an example that you can try :
<?php
ob_start();
?>
<html>
<body>
<br><br>
<?php
//starting the session
session_start();
echo("At the beginning of the page<br><br>");
print_r($_SESSION);
if(!isset($_SESSION["AAA"]))
{
$_SESSION["AAA"] = "ALLO";
echo("<br><br>Creation of AAA<br><br>");
}
else
{
unset($_SESSION["AAA"]);
echo("<br><br>Deleting AAA<br><br>");
}
echo("At the end of the page<br><br>");
print_r($_SESSION);
?>
<br>
<form action="#" method="get">
<input type="submit" value="Refresh">
</form>
</body>
</html>
<?php
ob_end_flush();
?>
This example work well on WinXP/IIS/PHP4.2.2. the first time you
create, the second you delete and the third time you recreate...
But on Linux/Apache/PHP4.2.2, the first time you create, the second you
delete and the third time you delete another time, just like all the
other time that will come after this one.
Jacques Bérard
papejack@hotmail.com
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19176&edit=1
Thread (2 messages)