Bug #33786 [Bgs]: $_SESSION not saving when an element's index contains pipe '|' character
Edit report at https://bugs.php.net/bug.php?id=33786&edit=1
ID: 33786
Updated by: arpad@php.net
Reported by: simon dot bettison at blueyonder dot co dot uk
Summary: $_SESSION not saving when an element's index
contains pipe '|' character
Status: Bogus
Type: Bug
Package: Session related
Operating System: Gentoo Linux
PHP Version: 5.1.0b3
Block user comment: N
Private report: N
New Comment:
It's an artifact of register_globals/session_register, could be fixed now
that they're gone and I wrote a patch to do so a couple of years ago but
some issues emerged and I haven't got around to addressing them yet.
If you raise a feature request someone else may get to it sooner.
Previous Comments:
------------------------------------------------------------------------
[2011-08-19 15:09:42] lgandras at gmail dot com
May i ask why isn't the full session just serialized like a normal array?
------------------------------------------------------------------------
[2005-07-20 13:37:34] sniper@php.net
| is not allowed in variable names. (yes, I know you can use it in array indexes, but $_SESSION is
special in many ways)
------------------------------------------------------------------------
[2005-07-20 13:23:54] simon dot bettison at blueyonder dot co dot uk
Description:
------------
A script registers a variable in $_SESSION using and index value which contains a pipe
("|"),
ie
$index = "some|index";
$_SESSION[$index]="some variable";
I expected this variable (and any other variables registered in $_SESSION) to be stored, and made
available to other script(s) executed in the same session for the lifetime of the session cookie.
However, subseqent access to $_SESSION indicates that the $_SESSION variable contains no data at
all.
This only seems to occur following the use of the pipe ("|") character in the
element's index.
Reproduce code:
---------------
<?php
session_start();
print_r($_SESSION);
$_SESSION["some|variable"]="some value";
print_r($_SESSION);
?>
Expected result:
----------------
First execution:
Array ( ) Array ( [some|variable] => some value )
Second & Subsequent execution
Array ( [some|variable] => some value ) Array ( [some|variable] => some value )
Actual result:
--------------
First execution:
Array ( ) Array ( [some|variable] => some value )
Second & Subsequent execution
Array ( ) Array ( [some|variable] => some value )
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=33786&edit=1
Thread (9 messages)