php.net |  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
Description:
------------
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:
---------------
<?php
  session_start();
  $_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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-04 19:04 UTC] tony2001@php.net
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:
C:\PHP\sessiondata

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

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] tony2001@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 09:01:30 2024 UTC