PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #38833 $_SESSION looses its ability to set session variables
Submitted:14 Sep 2006 5:40pm UTC Modified: 14 Sep 2006 6:04pm UTC
From:php at arcannon dot com Assigned to:
Status:Bogus Category:Session related
Version:5CVS-2006-09-14 (CVS) OS:Fedora Core 5
Votes:4 Avg. Score:4.8 ± 0.4 Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%) Same OS:4 (100.0%)
View/Vote Developer Edit Submission

[14 Sep 2006 5:40pm UTC] php at arcannon dot com
Description:
------------
$_SESSION looses its ability to set session variables when I do
$anythinghere = $_SESSION; This only happens when register_long_arrays =
Off

Reproduce code:
---------------
<?
// Bug with Sessions ?
// PHP Version 5.1.5
// Operating System: Fedora Core 5
// Only happens when register_long_arrays = Off
session_start();

echo "session_id: ".session_id()."<br />";
if(!array_key_exists('counter',$_SESSION)) { $_SESSION['counter'] = 0;
}
$anythinghere = $_SESSION;
echo $_SESSION['counter'];

// Play with commenting out these 2 lines and refreshing your page.
// $anythinghere['counter']++;
$_SESSION['counter']++;
?>

Expected result:
----------------
I expect that the session counter to increment on a page reload, but it
does not. 

Actual result:
--------------
The session counter does not increment.
[14 Sep 2006 5:48pm UTC] sp0n9e at gmail dot com
Also does not work with register_long_arrays

<?php
session_start();
echo session_id()."<br />";
if(!isset($_SESSION['foo']))
        $_SESSION['foo'] = 0;
$foo = $_SESSION; //works perfectly when this statement is commented
$_SESSION['foo']++;
echo $_SESSION['foo'];
?>
[14 Sep 2006 6:04pm UTC] tony2001@php.net
$_SESSION looses it's "magical" behaviour when assigned to any
variable.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC