#19176 [NEW]: The unset() function in the $_SESSION variable seems to work, but it doesn't !!

From: Date: Thu, 29 Aug 2002 18:06:17 +0000
Subject: #19176 [NEW]: The unset() function in the $_SESSION variable seems to work, but it doesn't !!
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18173@lists.php.net to get a copy of this message
From: papejack@hotmail.com Operating system: Linux PHP version: 4.2.2 PHP Bug Type: Session related Bug description: The unset() function in the $_SESSION variable seems to work, but it doesn't !! 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 bug report at http://bugs.php.net/?id=19176&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19176&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19176&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19176&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19176&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19176&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19176&r=support Expected behavior: http://bugs.php.net/fix.php?id=19176&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19176&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19176&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19176&r=globals

« previous php.bugs (#18173) next »