CodeIgniter Forums
Lost session - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Lost session (/showthread.php?tid=6693)

Pages: 1 2 3 4 5 6 7


Lost session - El Forum - 06-18-2008

[eluser]Blazer[/eluser]
I'm using now native session library and it seems all to be ok, and problems are solved. I think developers should include this library instead of a that one CI using now. It makes CI not stable...


Lost session - El Forum - 06-18-2008

[eluser]Derek Allard[/eluser]
Blazer, wakextreme, or anyone else reporting this. Can you provide any further information? I have a few questions

1) What is your sess_expiration set to?
2) Is your server's clock correct? Is your machine?
3) Is this reproducible in IE 6 or 8?
4) Anything to add? Any extra information that will track this? You've said it doesn't work, but I'm looking for more information to help me track this down. I've never been able to see it personally.


Lost session - El Forum - 06-19-2008

[eluser]Blazer[/eluser]
Derek, there is info:
1) 7200
2) It's correct, server is my machine where I'm developing
3) It happens in opera, firefox and IE, so I think browser is not a reason
4) After every session lost, there is record in logs:
ERROR - 2008-05-28 16:02:51 --> Severity: Notice --> unserialize() function.unserialize: Error at offset 1062 of 1588 bytes Z:\home\partner.mobistic.l\system\libraries\Session.php 215

It seems that sessions lib can't operate with a some kind of data or some symbols in it, which caused unserialize to fail..

If you have any other questions - please ask, I think we should solve this problem to make CI best ever framework Smile


Lost session - El Forum - 06-19-2008

[eluser]Henrik Pejer[/eluser]
Do you store your sessions in the database or in a cookie?
You are aware that if you use cookies and no database, there is a limit as to how much data you can store?


Lost session - El Forum - 06-19-2008

[eluser]Blazer[/eluser]
It doesn't matter database or cookie - the same problem happens, I tried to switch it in config. I counted size of serialized vars and that is 1318 bytes - is it very much?..


Lost session - El Forum - 06-19-2008

[eluser]Henrik Pejer[/eluser]
I do not know the exact limit, though I guess one should store only a limit amount of data in there.

The unserialization error suggests that the string it is trying to unserialize either is not a complete object, or there is an encodeing issue that messes things up.

Ofcourse there could be other issues aswell.

Can you serialize/unserialize the exact same data?


Lost session - El Forum - 06-19-2008

[eluser]Derek Allard[/eluser]
can you share the code you are using to generate the cookie in question? I'd like to see if I can reproduce. Which version of PHP?


Lost session - El Forum - 06-23-2008

[eluser]Blazer[/eluser]
Code:
class Projects extends Controller {
var $project, $service;

function __construct() {
   parent::__construct();
   $this->project = $this->session->userdata('project');
   $this->service = $this->session->userdata('service');
}

function select() {
   $this->session->set_userdata('service', $this->service);
   $this->session->set_userdata('project', $this->project);
   redirect('/projects');
}

function index() {
  var_dump($this->project);
  var_dump($this->session);
}

}

Code returns "false false";

var_dump of $this->service before set it to session in select() function:

object(stdClass)#29 (6) {
["id"]=>
string(1) "7"
["name"]=>
string(18) "Сообщения"
["regexp"]=>
string(0) ""
["file"]=>
string(8) "messages"
["prefix_id"]=>
string(1) "0"
["partner_show"]=>
string(1) "N"
}

..and var_dump of $this->project:
object(stdClass)#28 (14) {
["id"]=>
string(3) "102"
["name"]=>
string(37) "Сообщения Авторадио"
["regexp"]=>
string(0) ""
["delimiter"]=>
string(4) "none"
["keyword"]=>
string(3) "914"
["site_id"]=>
string(1) "0"
["partner_id"]=>
string(3) "103"
["service_id"]=>
string(1) "7"
["site_url"]=>
string(0) ""
["pass"]=>
string(0) ""
["created_on"]=>
string(19) "0000-00-00 00:00:00"
["active"]=>
string(1) "Y"
["description"]=>
string(0) ""
["data"]=>
string(0) ""
}

If variable's data is change (with the same structure) - session is still lost, this data is only shows example.
When I try to serialize and then unserialize this data, there's no errors, such as in system logs.
PHP version is 5.2.4


Lost session - El Forum - 07-17-2008

[eluser]StevenW721[/eluser]
I've come across one reproducible way of losing session data in Internet Explorer 6. A site that I recently worked on has links to MS Word .doc files, opening one of those files in the browser instead of choosing to save it locally resets the session information. I have the sessions stored in a DB, when I checked it I see two records for anyone that opens a document after logging into the site. one with a user agent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;" and the other is "Microsoft Data Access Internet Publishing Provider".

I've read here that something similar happens when using SWFUpload.

Not sure where to go from here, any ideas?


Lost session - El Forum - 07-29-2008

[eluser]Derek Allard[/eluser]
OK, I have a followup. I was finally able to recreate on a domain using IE. The problem was simply that I forgot to set
Code:
$config['cookie_domain']
after I added ".domain.com" to the config, it worked great. It seems this only mattered to IE. If anyone else had issues, I'd be grateful for corroboration on this issue.