|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40998 The length of key of session limited
Submitted: 2007-04-04 19:02 UTC Modified: 2007-04-04 19:52 UTC
From: jason dot polaris at gmail dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.4.5 OS: Windows XP
Private report: No CVE-ID: None
 [2007-04-04 19:02 UTC] jason dot polaris at gmail dot com
Currently I am trying to store a lot of data in the session (i.e. filename and things related to that particular file)
However some filename(with full path) can be more than 300 characters, and it is not stored if I use the path as a $_SESSION key.
Any key that contains less than 250 characters surely works well.

Reproduce code:
  $_SESSION['asdklfjsldfkjsldkfj(more than 300 chars)']['ABC'] = 1;


Expected result:
When reloading (or redirect to another page that reads session)
$_SESSION['asdklfjsldfkjsldkfj(more than 300 chars)']['ABC'] will equals to 1

Actual result:
The session array ($_SESSION['asdklfjsldfkjsldkfj(more than 300 chars)']['ABC']) is simply not set


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-04 19:04 UTC]
What kind of session storage are you using?
 [2007-04-04 19:14 UTC] jason dot polaris at gmail dot com
Currently I am using my XP machine, so I just put it in:

When I look inside the sessiondata folder, there is serveral files. I use my text editor to search for my target "key", I found:
which is part of a key that I had set. However, there is even more character goes beyond Windows_CH.............
For others, e.g.

The actual statement I have used:
$_SESSION['L_CHR058_CHR047AutoPlayv2_CHR047Autoplay_CHR032in_CHR032Windows_CHR032XP_CHR032_CHR032Automatically_CHR032Detect_CHR032and_CHR032React_CHR032to_CHR032New_CHR032Devices_CHR032on_CHR032a_CHR032System_CHR032_CHR045_CHR045_CHR032MSDN_CHR032Magazine_CHR044_CHR032November_CHR0322001_files_CHR047t_CHR046gif']['P3R'] = 1;
(I know, a little bit long...)
 [2007-04-04 19:52 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 05:01:32 2024 UTC