note 42594 added to ref.session

From: Date: Sat, 22 May 2004 18:01:47 +0000
Subject: note 42594 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-69969@lists.php.net to get a copy of this message
I found a strange (to me at least) behaviour with sessions when using HTTPS and thought to share it, might save others some headaches. Let's say that $_SESSION["message"] contains "old_message". Take the following code: $old_message = $_SESSION["message"]; $_SESSION["message"] = "new message"; echo "The message was: ".$old_message; Now, over HTTP you would get the expected output ("old_message"). But over HTTPS the output will contain "new_message". I don't know why this happends, nor do I know a proper workaround. You can use session_unregister("message") if you want $old_message to preserve its value, but this means you can't set anymore a new value for $_SESSION["message"]. ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42594 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42594&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42594&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69969) next »