From:             dayal at capital-merchant dot com
Operating system: Unix
PHP version:      4.3.4
PHP Bug Type:     Arrays related
Bug description:  associative arrays as session variables

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

-- 
Edit bug report at http://bugs.php.net/?id=27226&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27226&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27226&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27226&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27226&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27226&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27226&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27226&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27226&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27226&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27226&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27226&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27226&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27226&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27226&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27226&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27226&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27226&r=float

Reply via email to