My HTML-form mysteriously stopped working, why?

Nobody changed it, why is it not working anymore?

I am responsible for a website that uses a web-form for login. And of course the option to recover / reset the password is not missing. So as the time passed, the website worked for years without any problems.

Advertisements

One day, out of nowhere I got a message “The password recovery is not working”. Well, anyone familiar with getting problem reports knows that this description is a nightmare! So the first thing you do is opening the browser trying to prove that they are wrong and everything works. But I was surprised to see that there really is a problem.

You can imagine the confusion after checking the version control system and the files on the server. The files which where unchanged since the time the website was finished years ago. (sometime in 2008).

What exactly has changed?

From the investigation I was sure the script files where not changed. And I was sure that the function was working when I checked it last time. It took me awhile to realize that the files on the server where not the problem. As a matter of fact the “problem” was the browser. Only that it is not really a problem. The first observation showed that for some reason the browser behavior has changed. It seems like the submit button had changed its behavior.

<input type="image" src="image.gif" name="foo" />

From what you might expect, the PHP script should receive the submit item as “$_GET['foo']“. And it did when the website was released. I was surprised to see that the script now received it as “$_GET['foo_x']” and “$_GET['foo_y']“.

Why has the browser behavior changed?

To find out what is the reason for this changed behavior I started to investigate it. The research has brought a lot of interesting facts to the surface. Things that I was not aware of. But the biggest surprise was that the PHP script back in 2008 was only working because the browsers where not completely following the HTML specification.

I think stating all the details of it here in my post would be out of scope. The fact is that this behavior is meant to be specific to the so called image-submit-buttons. As for this fact it applies to all submit buttons with the “type=image” attribute. As a fact, already the HTML 4.01 specification from end of 1999 defines this. But as it seems the browsers did not support it. During my research it appeared to be an issue (bugzille #583211) that came up in Firefox in mid 2011 when the support for this was added to the Firefox browser. I guess other browsers implemented this around the same time.

You can find a more details about its behavior as well on the php.net website.


Read more of my posts on my blog at http://blog.tinned-software.net/.

This entry was posted in PHP, Web technologies and tagged , , . Bookmark the permalink.