#34862 [Opn->Bgs]: Variable's session data cannot be modified

From: Date: Thu, 13 Oct 2005 21:21:07 +0000
Subject: #34862 [Opn->Bgs]: Variable's session data cannot be modified
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86562@lists.php.net to get a copy of this message
ID: 34862 Updated by: tony2001@php.net Reported By: Lhunath at Pandora dot Be -Status: Open +Status: Bogus Bug Type: Session related Operating System: Linux Gentoo PHP Version: 5.0.5 New Comment: Remove this: if($t) or use if($_GET['t']) instead and it'll work. Previous Comments: ------------------------------------------------------------------------ [2005-10-13 23:12:00] Lhunath at Pandora dot Be Description: ------------ After a variable has been stored in the session file, it's content is available and visible in the file. However, when later the variable's content is altered; the file's content is not. It remains the same initial value. Because of this, the modification is lost. (the session file can be altered in this way: new variables can be added with their value. the session file cannot be altered in this way: existing variables in the file cannot have their value changed) Reproduce code: --------------- Avaria tmp # cat page1.php <?php session_start(); $_SESSION["test"] = "1"; ?> <a href="page2.php?t=2">go to page 2</a> Avaria tmp # cat page2.php <?php session_start(); if($t) $_SESSION["test"] = $_REQUEST["t"]; echo $_REQUEST["t"]; echo $_SESSION["test"]; ?> <a href="page3.php">go to page 3</a> Avaria tmp # cat page3.php <?php session_start(); echo $_SESSION["test"]; ?> Expected result: ---------------- go to page 2 22go to page 3 2 Actual result: -------------- go to page 2 21go to page 3 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34862&edit=1

« previous php.bugs (#86562) next »