|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40274 Sessions fail with numeric root keys
Submitted: 2007-01-29 13:40 UTC Modified: 2007-02-06 00:01 UTC
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: ben at vanilla dot net Assigned: iliaa (profile)
Status: Closed Package: Session related
PHP Version: 5.2.0 OS: FreeBSD 6.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ben at vanilla dot net
New email:
PHP Version: OS:


 [2007-01-29 13:40 UTC] ben at vanilla dot net
If you set a session variable with the root key as a numeric 
string it fails to save. It also fails to save anything else 
in the array after the numeric rook key string.

This was via FCGI with lighttpd, but also reproduced on Debian 
etch with apache2.

Reproduce code:
Set a session :-


$_SESSION['Test1'] = "This should be ok";
$_SESSION['123']['test']="This is a test";
$_SESSION['Test2'] = "This is not saved";
Session Set:
<?php print_r($_SESSION); ?>

Read it :-


Session Read:
<?php print_r($_SESSION); ?>

Expected result:
I would expect to see the same details in the session from the 
second piece of code as output from the first. :-

Session Read:
    [Test1] => This should be ok
    [123] => Array
            [test] => This is a test

    [Test2] => This is not saved

Actual result:
Session Read:
    [Test1] => This should be ok


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-29 13:48 UTC] ben at vanilla dot net
Juts noticed this is the same with numeric strings and 
ordinary numeric keys.
 [2007-02-02 18:57 UTC] jhansen at unitedmcgill dot com
I had a similar issue on a gentoo box (I could not make changes to session variables), and came across this blog post:

Sure enough, turning off register globals fixed the problem for me. iliaa: Could this be related?
 [2007-02-05 09:15 UTC] ben at vanilla dot net
register_globals is set to Off anyway in php.ini file so 
whilst it sounded like a good idea, its unfortunately not a 
fix for this issue.
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 17:01:30 2019 UTC