|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-08-29 14:21 UTC] sander@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 10:00:01 2026 UTC |
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