|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34943 when saving $_SESSION to new variable it stops working
Submitted: 2005-10-21 11:43 UTC Modified: 2005-10-21 11:47 UTC
From: acecream at ctgmusic dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.0.5 OS: windows xp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: acecream at ctgmusic dot com
New email:
PHP Version: OS:


 [2005-10-21 11:43 UTC] acecream at ctgmusic dot com
When i save $_SESSION to some local variable then afterwards what ever i put into $_SESSION has no affect on next page load, from the moment when $_SESSION is saved into new variable it seems nothing is written into actual session anymore.

Reproduce code:


$session = $_SESSION;  // without this line it works ok 
$_SESSION['test'] = 1000; 


Expected result:
You need to run this code atleast twice so that first time session is set and next time it should be printed out but the thing is that i always get empty array.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-21 11:47 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Sorry, but this is not a bug - you should not modify the $_SESSION array like this (assigning it to another var modifies it). There is also no reason to do this...
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 12:01:34 2024 UTC