Bug #17122: Values set in _SESSION doesn't stick

From: Date: Thu, 09 May 2002 15:34:41 +0000
Subject: Bug #17122: Values set in _SESSION doesn't stick
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7333@lists.php.net to get a copy of this message
From: mats@cdmedia.nu Operating system: Linux RH 7.2 PHP version: 4.2.0 PHP Bug Type: Session related Bug description: Values set in _SESSION doesn't stick I'm having problems using $_SESSION, it throws away some of my values between page loads. The following code triggers the problem. <? session_start(); print "<PRE>"; print "Current values:\n"; print '"foo"=' . $_SESSION["foo"] . "\n"; print '4=' . $_SESSION[4]."\n"; print '"a"=' . $_SESSION["a"]."\n"; $_SESSION["foo"] = "bar"; $_SESSION[4] = "four"; $_SESSION["a"] = "b"; if(!isset($_SESSION["counter"])) $_SESSION["counter"] = 1; else $_SESSION["counter"]++; print "Count = ".$_SESSION["counter"]."\n"; print "</PRE>"; ?> The first run, it prints this: Current values: "foo"= 4= "a"= Count = 1 Which is what is expected, since the values haven't been set yet, except for the counter. Now the second run, this is where the problem show up: Current values: "foo"=bar 4= "a"= Count = 1 This seems to be wrong! The first value has been set, but none of the others. The counter should have been incremented also. The expected result of the second run would be Current values: "foo"=bar 4=four "a"=b Count = 2 -- Edit bug report at http://bugs.php.net/?id=17122&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17122&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17122&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17122&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17122&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17122&r=support Expected behavior: http://bugs.php.net/fix.php?id=17122&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17122&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17122&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17122&r=globals

« previous php.bugs (#7333) next »