Last month, my wife informed me that she couldn’t post comments on this site using IE6. I found a work-around, but never got around to tracking down the real source of the problem. I received an email from Michael Heilemann this morning, informing me that this problem was back. I had forgotten all about it, so when I updated my site to a newer version of WordPress, the problem reappeared.
I finally spent a few minutes digging around and found the source of the problem. It’s an interaction between my local PHP configuration, WordPress, Liorean’s Style Switcher, and apparently a bug in Internet Explorer. Hmm… where do I start? PHP has a setting called “register_globals“, which my web server has turned on, to support some legacy code. This means that variables set via cookies, GET, or POST requests are automatically turned into global PHP variables. Next, WordPress has some code which attempts to reset certain global variables that it is going to use, but only if they aren’t already set. Next, we have Liorian’s theme switcher (which I use on my site), which checks for cookie support by setting, then deleting a cookie named ‘c‘. And lastly, we have IE6, which apparently does not delete said cookie when told to do so.
So. Someone visits my site with IE6. The theme switcher code attempts to verify cookie support. IE6 erroneously leaves a cookie named ‘c‘ in the environment. PHP sees the cookie and registers a global variable, ‘$c‘. WordPress sees that there is already an empty global variable named ‘$c‘, and so decides not to reset it using the value passed in the GET querystring. And because the value of the ‘$c‘ PHP variable is used to determine whether or not to show the form for leaving comments, you can’t.
Anyhow it’s fixed. I’ve turned off ‘register_globals‘ for my blog.