ID:               37444
 User updated by:  grueff at libero dot it
 Reported By:      grueff at libero dot it
 Status:           Bogus
 Bug Type:         Session related
 Operating System: Win XP
 PHP Version:      5.1.4
 New Comment:

Excuse me, but why it is expected?

And why this is not mentioned in any part of the documentation?

And, again, why this was not the case in previous PHP versions?


Previous Comments:
------------------------------------------------------------------------

[2006-05-15 08:23:01] [EMAIL PROTECTED]

This is expected behaviour.
_SESSION arrays looses its magic characteristics when you overwrite it
with another array.

------------------------------------------------------------------------

[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

Reply via email to