could sessions get corrupted?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

could sessions get corrupted?

Post by yacahuma »

Is there anyway sessions could get corrupted. The last 2 weeks I am getting this very, very weird problem. I enter my username + password, I login into the application. I now logout(sessions get destroy). I now create a new user, and now I get either one of 2 things
1. I get the session from another user
2. i get kick back to the login page.

I login in again, and everything is fine. I NEVER seen this before in all the years working with php. So far this is just in my development machine. It happens once every 20 o so times. But it bothers me like hell. I been through the code a 1000 times looking to see if there is anything strange. But I just do the normal, login in, check user credentials, save user info in session and continue.

Any ideas.

Thank you
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: could sessions get corrupted?

Post by iankent »

are you doing anything to your session variables when creating a new user? unless you want to log the new user in as soon as its created, you shouldn't need to do anything with the login session variables at all.

code would help :)
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: could sessions get corrupted?

Post by yacahuma »

i just put a small class in the session so i can do database lookup
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: could sessions get corrupted?

Post by iankent »

Could you post some code? Its difficult to say why its not working without seeing what your code is doing.
User avatar
morris520
Forum Commoner
Posts: 60
Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK

Re: could sessions get corrupted?

Post by morris520 »

better to see your class. something wrong there!
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: could sessions get corrupted?

Post by yacahuma »

instead of saving the full object, i just created a new userSession class that only has the bare minimum. I wonder if somehow my class was not properly being serialized into the session?? The strange behavior is not there any more (for now)
User avatar
morris520
Forum Commoner
Posts: 60
Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK

Re: could sessions get corrupted?

Post by morris520 »

That's never happened in PHP!
Post Reply