#37444 [Opn->Bgs]: Session not saved if $_SESSION array assigned as a whole array
| From: | tony2001@php.net | Date: | Mon, 15 May 2006 08:23:01 +0000 |
| Subject: | #37444 [Opn->Bgs]: Session not saved if $_SESSION array assigned as a whole array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-97093@lists.php.net to get a copy of this message | ||
ID: 37444
Updated by: tony2001@php.net
Reported By: grueff at libero dot it
-Status: Open
+Status: Bogus
Bug Type: Session related
Operating System: Win XP
PHP Version: 5.1.4
New Comment:
This is expected behaviour.
_SESSION arrays looses its magic characteristics when you overwrite it
with another array.
Previous Comments:
------------------------------------------------------------------------
[2006-05-15 08:09:29] grueff at libero dot it
Description:
------------
If i put values in $_SESSION array by inserting them as array elements
such as this:
$_SESSION["a"]="test";
All does function ok; but if i prepare a whole array of values and put
it in the session such as this:
$prep=array("test1","test2","test3","test4");
$_SESSION=$prep;
NOTHING gets written in the session, and any subsequest pages loading
the session will get an empty session array.
Reproduce code:
---------------
This writes the session
<?php
session_start();
$tize=array("uno","due","tre","quattro","cinque","sei");
$_SESSION=$tize;
print_r($_SESSION);
?>
This tries to read the session:
<?php
session_start();
print_r($_SESSION);
?>
Expected result:
----------------
Output the content of $tize array!
Actual result:
--------------
Outputs an empty array!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37444&edit=1