Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] What's the deal with HTTP_ACCEPT? (Was: Wanna see my open source project?)



Ian, Kenneth,

Thank you for responding.

After a looooong and tedious debugging session, I finally narrowed down the problem to a single line of code that was causing all the problems.

That line is simply this:

$ac = strtolower($_SERVER['HTTP_ACCEPT']);

Long story short - some browsers don't send back a value for HTTP_ACCEPT, so it is not even empty, the entry doesn't even exist in the $_SERVER array. Since this variable is being looked at *before* the session starts, somehow the act of discovering it isn't there causes a session to get started, but not with the right data (probably a mostly empty $_SESSION array). From that point on, the mangled session causes everything to die horribly.

The solution is easy enough:

$acSet = isset( $_SERVER['HTTP_ACCEPT']);
if ($acSet)
  {
    $ac = strtolower($_SERVER['HTTP_ACCEPT']);
  }
else
  {
    $ac = '';
}

So now my sites are back up and running, and validating, and everything is working.

But I'm puzzled why this one entry in $_SERVER is so problematic. If it can't be found, why not simply return null or an empty string?

--
Dave M G
http://www.tlug.jp/wiki/User:Dave_M_G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links