|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-14 17:40 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 18:00:01 2025 UTC |
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']; ?>