|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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);
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 05:00:01 2025 UTC |
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>' ; ?>