|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-02-11 17:43 UTC] dayal at capital-merchant dot com
Description:
------------
PHP Version: 4.3.2
------------------
Hi,
I am using an associative array as a session variable.
Randomly this variable fails in the sense that all values corresponding to the keys are lost.
To see if this problem is specific to associative arrays I have added another simple variable to the session. The application is able to retrieve this other variable from the session all the time, even when the associative array fails.
Is there any problem using associative arrays as session variables in php??
Reproduce code:
---------------
<?php
session_start();
$ar = array();
$ar["name"] = "xxxx";
$ar["password"] = "yyyyy";
$_SESSION["arrayvariable"] = $ar;
$_SESSION["numericvariable"] = 30;
Header("Location: test2.php");
?>
Expected result:
----------------
test2.php
---------
<?php
session_start();
echo "Your name: ".$_SESSION["arrayvariable"]["name"];
echo "Numeric value: ".$_SESSION["numericvariable"];
?>
Expected Result:
---------------
Your name: xxxx
Numeric value: 30
Actual result:
--------------
Your name:
Numeric value: 30
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 16:00:02 2025 UTC |
hmmm... i've the same problem here. installed horde framework with ingo-filter manager. this is using hashes like $_SESSION['ingo']['edit']. example: if a edit link is clicked, than this happens in the target script: --- $_SESSION['ingo']['edit'] = $id; header('Location: ' . Horde::applicationUrl('rule.php')); --- if register_globals is off all works fine. if it is "on", the $_SESSION['ingo']['edit'] variable is not defined in the rule.php script. now if i reload the page (F5) everything is there... php version is 4.3.4