Strange PHP session problem

software development

#1

I have a page that has session_start() right from the beginning. The page is a form that takes user inputs and posts back to itself. Upon checking and validating user inputs, it then writes to the database. So far so good and everything used to be fine. A couple of days ago, I did an upgrade to generalise the main content of the page out to another file because the main content can be used somewhere else as well. I use “include” function to include the file and things started to break down. I noticed from error messages that some users weren’t able to make a successful post because their sessions disappeared (this form is available only to registered users). What I have changed was simply generalising the content out to another file and have it included, why would this cause this weird session problem? The problem is really trick as well because it is intermittent meaning it only failed for some users, not all of them. Any idea? Thanks in advance for the help.


#2

Do a test from your own PC using IE6, IE7, Opera, and Firefox.

The apparent intermittency might be browser/settings specific.

Maximum Cash Discount on any plan with MAXCASH


#3

IE6, IE7 and Firefox all worked fine on me. I have yet to be able to replicate the error.


#4

Is it the same few users consistently having a problem, or does it seem to come and go more or less randomly even for people who do experience the error? If it’s the same few users consistently having trouble, they probably have something in common which will point you at a cause.

The only other thing that comes to mind is that you might be accidentally calling some of the session code twice as a consequence of how you’re including things. Misusing session code can sometimes cause some pretty screwy results, so even though I assume this is unlikely, it might be a good thing to look at while you wait for better information about how to reproduce the error.


#5

Thanks I’ll check on that.

As for whether it’s the same group of people having this issue, 1st of all I can’t tell because that’s the whole point (they’ve lost their sessions) :slight_smile: I think it’s more random though, not just a particular group of users.