php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16202 session variables not getting set
Submitted: 2002-03-21 05:28 UTC Modified: 2002-05-21 00:00 UTC
Votes:18
Avg. Score:4.8 ± 0.5
Reproduced:15 of 15 (100.0%)
Same Version:10 (66.7%)
Same OS:8 (53.3%)
From: mikah at ceruleansoftware dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 4.1.2 OS: win 2000 pro
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mikah at ceruleansoftware dot com
New email:
PHP Version: OS:

 

 [2002-03-21 05:28 UTC] mikah at ceruleansoftware dot com
Setup: win2k pro, apache-win 1.3.23, php 4.1.2 (sapi)

Session variables set using this method

    $_SESSION['quux'] = 'foo'

don't get set. Using session_register() works though. This is the case with _both_ CGI and SAPI versions

I verified this by opening up the session file in an editor. It is created but not written to in the first case, and *is* written to when using session_register().

I tried toggling register_globals, changing location of session file directory, making sure it had correct access permissions, trying the CGI, restarting apache, tweaking the session cookie parameters, explicitly calling session_write_close(). None of these worked.

Rolling back to php 4.1.1 solved the problem.

Here's a script to reproduce the problem:

----- file test1.php -----
<?php
    session_start();
    $_SESSION["roy"] = "haynes";
    header("location: ./test2.php");
?>

----- file test2.php -----
<?php
    session_start();

    //
    // displays empty array
    //
    var_dump($_SESSION);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-21 05:47 UTC] chippyho at maildozy dot com
I have the same problem .

Here is my profile.

OS : WIN ME
Apache-Win32 1.3.23
PHP 4.1.2

PHP can not get the value from _SESSION[] even if from itself this is my code to test.  Back when rollback to 4.1.1 the problem solve.
 [2002-03-21 05:58 UTC] chippyho at maildozy dot com
Sorry.. here this is my code.

<?
// Chippyho & Tuna
session_start() ;
session_register('a','b','c') ;

if(isset($_SESSION[a])) {
	$_SESSION[a]++ ;
} else {
	$_SESSION[a] = 0 ;
}

if(isset($b)){
	$b++ ;
} else {
	$b=0;
}

if(isset($HTTP_SESSION_VARS[c])){
	$HTTP_SESSION_VARS[c]++;
}else {
	$HTTP_SESSION_VARS[c] =0;
}

echo '$_SESSION[a]  = ' . $_SESSION[a] ;
echo '<br>$b = ' . $b ;
echo '<br>$HTTP_SESSION_VARS[c] = ' . $HTTP_SESSION_VARS[c]  ;
echo '<br><br><a href="'.$PHP_SELF .'">Click</a>' ;
?>
 [2002-03-21 10:37 UTC] fseesink at usa dot net
See problems #16043 & #16102.  Same issue.  In a nutshell, sessions are broke in v4.1.2, and they say it'll be fixed in v4.2.0.

You may not have found these problems before posting this one due to the search page default of only looking for 'Open' problems.  #16043 has been closed (they apparently close problems when its fixed in the head CVS branch, NOT when they put out a new release), and #16102 is tagged as 'analyzed', though in #16102 the same PHP developer said it will 'be fixed in 4.2.0, probably.'

Please don't shoot the messenger.  Just wanted you all to know you are not alone.  Sessions are broken in 4.1.2, there are several bug reports effectively showing this, and there appear to be many people hurting without proper session support.  For now, our options appear to be

1. Run 4.1.2 and suffer no session support
2. Run 4.1.1, have session support, and risk the security issues. (Though this may be mitigated by running the SAPI module vs. the CGI.  Still issues, but not as severe from what I understand.)
3. Download the latest CVS & "roll your own" if you have the tools/skill/etc. to do so.
4. Download the 4.2.0 Release Candidate if you're not in a production environment & don't mind being a guinea pig.

If you haven't seen yet, they're aiming for 22 Apr 2002 for the v4.2.0 release.  I wait with breathless anticipation.
 [2002-04-02 09:43 UTC] yohgaki@php.net
Could you try 4.2.0RC1?
Please visit http://qa.php.net/ for it.
 [2002-04-17 16:01 UTC] jason at peaceworks dot ca
I'm having the same issue, and have just confirmed that this problem is _not_ fixed as of PHP 4.2.0RC4.
 [2002-04-18 11:33 UTC] sniper@php.net
When you upgrade PHP (or downgrade) remember to ALWAYS
replace all the files from previous installations with
the new files found in the new package. Including php4ts.dll. Also check that you don't have duplicates of
these files in your system. 

--Jani

 [2002-05-21 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 12:01:27 2024 UTC