Oliver Nassar

Weird discovery: firefox converts $_SERVER, SF doesn't?

September 29, 2009

This is definitely up there for me; a very weird discovery about how firefox and safari differ in the way the $_SERVER array is returned.

print_r($_SERVER);
exit();

Run that code in a php script; then check the source in both safari and in firefox. For the path, try something like index.php?name=what'sup

The weird thing comes in with the fact that in Safari, the apostrophe isn't converted/encoded, where as in Firefox, it is. I'm not really sure how I can explain this, and if I'm missing something, but it's caused me a great deal of frustration and debugging. The only thing I can think of is that safari sends along different headers in the request than Firefox does, and therefore gets different results. I'll look into it and update this post, but thought it was worth mentioning incase anyone else runs into the same type of problem.