CodeIgniter Forums
Sessions, some work, some donn't. - 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: Sessions, some work, some donn't. (/showthread.php?tid=28417)

Pages: 1 2


Sessions, some work, some donn't. - El Forum - 03-12-2010

[eluser]jedd[/eluser]
[quote author="smick" date="1268316807"]
Interesting? You're having trust issues with me?
[/quote]

Not just you - but anyone who makes blanket statements like 'the problem occurs with every browser'. It's just additionally frustrating that that nugget didn't come through in your first post. You have enough experience in these forums to have found the earlier threads on session problems, so you don't have any excuse for not explaining that you aren't having the 'usual IE6, 7, 8 problem'.

Quote:I have wacky sessions, and yes, I know it's likely either a problem with the server time/expiration, or maybe the domain path.

It's really handy if you explain what you've done to investigate a problem - it saves time for other people, as well as demonstrating your level of trouble-shooting skill.

I'd suggest that in the first instance you should distil the problem down to a small a lump of code as possible, such that you would be happy to share it with the world. Obviously you test that on a new instance of an OS somewhere. You might want to mention what server OS and component versions you're using, too. It's the kind of thing that can be enlightening for people trying to help you. (etc)

If you can get a shareable tarball that consistently exhibits the error that you're describing, then I'm sure that (as per [url="http://ellislab.com/forums/viewreply/669772/"]this message[/url]) Derek Allard, and doubtless several other people, would be very happy to play with the code and work with you to identify the root cause.

Absent any demonstration code, it's just impossible to come up with useful suggestions for things to try.

Quote:For whatever reason sessions aren't writing, at least not in the model, and I haven't been able to figure out why.

Can you clarify this observation. Do sessions work fine if you handle them in your controller(s)?


Sessions, some work, some donn't. - El Forum - 03-12-2010

[eluser]smick[/eluser]
So writing sessions works everywhere else on the site except for in my model.

It sounds like a bug in my model, but I tried restoring it to a version that I was running several months back when sessions were working and they still aren't working. I've tried restoring the controller that calls the model and that didn't work. I restored the view file that was working and that didn't work either. That should rule out a bug in my code, since it was working last month. This is problematic, I was expecting to launch this new version of our site this weekend and this is the last thing to do after nearly 6 months of development!

Blast!


Sessions, some work, some donn't. - El Forum - 03-12-2010

[eluser]jáquer[/eluser]
This is a shot in the dark, but have you made sure there's no data being output before you set the session? Session data is handled by cookies, and those go in the headers, which require no output before being sent.


Sessions, some work, some donn't. - El Forum - 03-12-2010

[eluser]smick[/eluser]
problem solved! I whittled down all of my code and discovered that I was setting the same session in a controller. My fault!

So glad it wasn't a problem with my 1234 line model (mostly stupidly complex sql queries)!

Thanks for all the help!


Sessions, some work, some donn't. - El Forum - 03-13-2010

[eluser]jedd[/eluser]
[quote author="smick" date="1268460080"]
It sounds like a bug in my model, but I tried restoring it to a version that I was running several months back ....
[/quote]

[url="http://progit.org/book/ch6-5.html"]git bisect[/url] is your friend with these kinds of problems. (Though it sounds like you're not using a VCS at all - if so, tsk tsk Smile

Glad to hear that it was not a CodeIgniter problem at all.

Aside - I tend to do all my session stuff in controllers, even if it means double-handling them into method parameters, or attributes, on the model side. Not sure if this approach would have prevented this specific problem, but might have made discovering it a bit easier.


Sessions, some work, some donn't. - El Forum - 03-13-2010

[eluser]jáquer[/eluser]
[quote author="jedd" date="1268494944"][url="http://progit.org/book/ch6-5.html"]git bisect[/url] is your friend with these kinds of problems.[/quote]

Wow, that command looks amazing. Thanks for that tip.