php.net |  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
 [2005-10-21 11:43 UTC] acecream at ctgmusic dot com
Description:
------------
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:
---------------
<?php 

session_start(); 

print_r($_SESSION); 
$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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-21 11:47 UTC] derick@php.net
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 http://www.php.net/support.php 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: Thu Dec 26 12:01:30 2024 UTC