Tuesday, November 1, 2011

New filters

A few weeks ago, we noticed some issues with the submissions to the site. For instance, people were writing their entries in ALL CAPS! Or they were forgetting dates, or to submit a status "color" or something else. Or they were using the site to propagate political views. So I put a bunch of new filters in. (Note: if you're not a nerd, you can probably stop reading here.) And I asked people to report if the filters were causing any problems. I tried them, and they worked. But, as we all know, making any changes can create any number of other issues arise.

So I got an email from someone who was unable to submit. They sent me a screenshot:


and were receiving an error message to please TURN OFF THE CAPS LOCK key. I pretty quickly figured out what the problem was, and fixed it. So, before I tell you what it was, take a quick think . I'll put the answer in the comments.

1 comment:

  1. The issue was that, to catch all-caps entries, I'd used the PHP

    strtoupper($notes) == $notes

    which converts the given string to capitals and sees if it matches the input—if it does, it's rejected. The issue was that an empty string is the same in uppercase, even though it doesn't have any capital letters. Since we don't require a notes field, the submitter who hadn't filled it in was violating this. By changing the error to only apply to string lengths greater than 0, this bug should be fixed.

    ReplyDelete