#38048 [NEW]: $_SESSION cannot be changed after copying into it another array
| From: | seitenzahl at hotmail dot com | Date: | Sun, 09 Jul 2006 15:03:34 +0000 |
| Subject: | #38048 [NEW]: $_SESSION cannot be changed after copying into it another array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-99250@lists.php.net to get a copy of this message | ||
From: seitenzahl at hotmail dot com
Operating system: Windows XP
PHP version: 5.1.4
PHP Bug Type: Session related
Bug description: $_SESSION cannot be changed after copying into it another array
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 bug report at http://bugs.php.net/?id=38048&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38048&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38048&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38048&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38048&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38048&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38048&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38048&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38048&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38048&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38048&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38048&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38048&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38048&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38048&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38048&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38048&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38048&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38048&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38048&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38048&r=mysqlcfg