I spent about an hour debugging a dumb behavior of Internet Explorer.Â The problem site is one that stored some session data in PHP’s $_SESSION variable for display later.Â The form would use parameters from the GET request to populate some data in the users $_SESSION.Â Upon trying to retrieve the data in a subsequent page though, it was missing or incorrect.. but only in Internet Explorer.
The failure of PHP Sessions is typically a server-side problem, so it didn’t make sense that the browser was causing a problem.Â Â I spent a while verifying that the sessions were, in fact, working properly in all different browsers, but that still didn’t explain the problem.
The odd behavior comes, though, when the page had an image tag with a blank “src” parameter.Â Â Â This causes most browsers to try and fetch the current page.Â Â But Internet Explorer tries to fetch the parent directory.
For example, if your page is a http://www.somesite.com/somedirectory/somepage.php, most browsers will try and fetch that URL for images with a blank src parameter. Â Internet Explorer, though will try to fetch http://www.somesite.com/somedirectory/
Either case is really not what one would expect. Â I would think that without a destination, it wouldn’t try to fetch anything.Â Attempting to fetch the page that called it (obviously not a graphic) or the parent directory (why would it do that) doesn’t really make any sense.
In this case, fetching the parent directory hit my problem script since it was the DirectoryIndex (index.php).Â Â Calling the script without any parameters erased the saved variable that I was looking for, so the subsequent page that I hit was missing this variable.
I guess the moral of the story is to not leave images with a blank src parameter, because it will do weird things.
I’ve written up a sample page available atÂ http://www.brandonchecketts.com/examples/ie_blank_img_src_tag/index.php to demonstrate what I’m talking about