php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24810 sessions not overwritten properly
Submitted: 2003-07-25 16:31 UTC Modified: 2003-07-28 10:44 UTC
From: dkaplan1 at uiuc dot edu Assigned:
Status: Closed Package: Session related
PHP Version: 4.3.1 OS: Solaris SunOS 5.9
Private report: No CVE-ID: None
 [2003-07-25 16:31 UTC] dkaplan1 at uiuc dot edu
Description:
------------
Data that is newly written to the session hash is not getting stored correctly.  If I am storing two pieces of data (a string and a type of view for example) in the session hash, the hash should only contain the latest values of those two variables.  Instead, as in the example provided, the form randomly changes between the views, and the data shown is not always the latest in the hash.  Usually, it is from previous submissions.  
This seems to be a problem in IE and Netscape, but not in Mozilla.

Reproduce code:
---------------
<?
session_cache_limiter('public');
session_start();
if (isset($_POST['submit'])) {
  $_SESSION['data']=$_POST['data'];
} if (isset($_GET['form'])) {
  $_SESSION['form']=$_GET['form'];
} if (!isset($_SESSION['form'])) {
  $_SESSION['form']='basic';
} if ($_SESSION['form']=='basic') {
  echo 'The value of the variable is '.$_SESSION['data'];
} if ($_SESSION['form']=='advanced') {
  echo 'Here is a complete dump of the session hash ';
  var_dump($_SESSION);
}
?><br><br>
<a href=bug.php?form=basic>Basic</a><br><a href=bug.php?form=advanced>Advanced</a><br>
<form method=post action=bug.php>Data: <input type=text name=data value="">
<input type=submit name=submit value=submit></form>


Expected result:
----------------
When you type in a value, it should appear.  When you switch views, the data value should stay the same, only the view changes.  When you enter different data, only the data changes, the view stays the same.

Actual result:
--------------
View randomly changes and data is not always last entered.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-28 10:44 UTC] dkaplan1 at uiuc dot edu
I tried the latest snapshot with no change.  However, making the session_cache_limiter 'private, must-revalidate' instead of 'public' fixed the problem.  Some better documentation would have been nice.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 19:01:28 2024 UTC