Archive for December, 2007

Application hanging on mac

December 17, 2007

The registration page of an application I was working on wasn’t working on mac – after clicking “submit” on the enter-your-details page the browser would just hang. The application has a page-based structure, so the form is submitted to itself and then if it validates the browser is forwarded to the next page using header(“Location: …”). The problem turned out to be two calls to session_start(). I already had an idea it was the session that was causing a problem because after attempting to register all pages on the site were hanging until I restarted the browser, then I found a post by kyzer at 4u dot net on saying recursive session use is impossible, and you can’t fetch “another page on the site which uses sessions, as part of a page which itself uses sessions”.

Now, the application wasn’t exactly doing this, as I would have thought that the header() call is equivalent to calling two separate scripts (i.e. page1 gets executed, sends a location header to the browser, then page2 gets executed without knowing anything about page1) … but in the end I solved the problem by calling session_write_close() before header(“Location: … “).

Kinda puzzling. Good that it’s working now though