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

go to bug id or search bugs for  

Bug #33786 $_SESSION not saving when an element's index contains pipe '|' character
Submitted:20 Jul 2005 1:23pm UTC Modified: 20 Jul 2005 1:37pm UTC
From:simon dot bettison at blueyonder dot co dot uk Assigned to:
Status:Bogus Category:Session related
Version:5.1.0b3 OS:Gentoo Linux
View/Vote Developer Edit Submission

[20 Jul 2005 1:23pm UTC] 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 )

[20 Jul 2005 1:37pm UTC] 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)

RSS feed | show source 

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