This one has me tearing my hair out. The problem is intermittent, and so far I haven’t been able to locate it.
A few times a day my client’s web site loses everything in $_SESSION. I’ve searched for an obscure bit of code that creams $
Since the problem is very rare, the only way I can investigate it is to put lots of logging statements in my code and try to reconstruct what happened after a problem occurs. It makes the testing cycle very slow, and going through the data is slow, too.
The problem seems to be associated with two of the site’s scripts; it always happens when those two scripts are loaded (or shortly before, after my last test of $_SESSION on the preceding page, or shortly after, before I can test it again). I haven’t identified any common factor that would point toward a guilty party, though.
I found a couple of references to similar problems on the web; one is associated with PHP 5.2.6, and the other with redirecting by writing a header without closing the session first. Neither one seems to apply here: the server is running 5.2.17, and the site doesn’t do redirection by writing headers.
Does anyone have suggestions about what to look for?
Or general advice on how to approach a problem like this one?