ID:               38048
 User updated by:  seitenzahl at hotmail dot com
-Summary:          $_SESSION cannot be changed after copying into it
                   another array
 Reported By:      seitenzahl at hotmail dot com
 Status:           Open
 Bug Type:         Session related
 Operating System: Windows XP
 PHP Version:      5.1.4
 New Comment:

Fixed a typo in the summary.


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

[2006-07-09 15:03:34] seitenzahl at hotmail dot com

Description:
------------
After doing something like 
$oldsessiondata = $_SESSION;
the changes to $_SESSION won't be committed to the session itself
anymore.

I don't think $_SESSION should lose its magic properties in this case.

Reproduce code:
---------------
<?php
session_start();
$_SESSION['testbefore'] = 'foobefore';
print_r($_SESSION);
$oldsessiondata = $_SESSION;
print_r($_SESSION);
$_SESSION['test'] = 'foo';
print_r($_SESSION);
?>

Expected result:
----------------
Array
(
    [testbefore] => foobefore
)
Array
(
    [testbefore] => foobefore
)
Array
(
    [testbefore] => foobefore
    [test] => foo
)

After reload:
Array
(
    [testbefore] => foobefore
    [test] => foo
)
Array
(
    [testbefore] => foobefore
    [test] => foo
)
Array
(
    [testbefore] => foobefore
    [test] => foo
)

Actual result:
--------------
Array
(
    [testbefore] => foobefore
)
Array
(
    [testbefore] => foobefore
)
Array
(
    [testbefore] => foobefore
    [test] => foo
)

After reload:
Array
(
    [testbefore] => foobefore
)
Array
(
    [testbefore] => foobefore
)
Array
(
    [testbefore] => foobefore
    [test] => foo
)


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


-- 
Edit this bug report at http://bugs.php.net/?id=38048&edit=1

Reply via email to