php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29452 Session vars lost on changing page
Submitted: 2004-07-30 01:51 UTC Modified: 2004-08-10 01:00 UTC
Votes:6
Avg. Score:4.3 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:3 (50.0%)
From: gattas at yahoo dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 5.0.0 OS: Win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
40 + 26 = ?
Subscribe to this entry?

 
 [2004-07-30 01:51 UTC] gattas at yahoo dot com
Description:
------------
Hi everyone.
Using PHP 5.0.0 with Apache/1.3.31 (Win32) on XP, everything seems to be set up in the way it should be (in fact, I compared my .ini with another system's .ini that I'm developing -different configuration: Win 2000, IIS 5, PHP 4.3- where everything's allright and the two files match exactly) but when I change the page the variables are lost no matter if I use $_SESSION or $HTTP_SESSION_VARS or SESSION_REGISTER.


Reproduce code:
---------------
// login.htm
<form name="impData" method="post" action="login_do.php">
  <table width="171" align="left" style="font-size:12;">
    <tr> 
      <td width="90">User:</td>
      <td width="93"><input name="user" type="text" class="box-text" size="10"></td>
    </tr>
    <tr> 
      <td>Password:</td>
      <td><input name="pass" type="password" class="box-text" size="10"></td>
    </tr>
</table></form>
//login_do.php
<? session_start();
   $_SESSION['user']=$usr;
   echo $_SESSION['user']; ?>
// other_page.php
<? echo $_SESSION['user']; ?>

Expected result:
----------------
I expect to see the user that I wrote in login.htm in  other_page.php when doing echo and to have the session variables at my disposal.

Actual result:
--------------
In login_do.php I can see them but not in other_page.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-30 16:47 UTC] alex at avannaproductions dot com
I have a similar problem on MacOS X. Not sure if it is 
related. Using 5.0.0 release, all is well, however in 
the CVS releases the following problem occurs. The first 
time I load a page with this code:

session_start();
$_SESSION[c]++;
echo "test: $_SESSION[c]";

It sets a cookie for the session and echoes "test: 1". 
When I reload the page, instead of getting "test: 2", 
the browser refuses to load the web page and reports 
"unable to retrieve any data from location." I isolated 
the problem line to session_start(), which means there 
is simply a bug in the *re*opening of a session. If I 
reinstall the 5.0.0 release, while changing nothing 
else, it works as expected once again.
 [2004-08-02 15:17 UTC] alex at avannaproductions dot com
Well my problem was fixed with the August 2 CVS check-
ins by Sascha?Schumann.
 [2004-08-02 15:45 UTC] gattas at yahoo dot com
Where can i found the August 2 CVS check?
Regards.
 [2004-08-02 15:48 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2004-08-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-08-17 18:00 UTC] jpveilleux at stylishdesigns dot net
I'm not sure but it might be that you need to start your session within every page that you use your session variables.

If this is not the problem then disregard this comment :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 05:01:30 2024 UTC