unnecessary error reported for options validations
| Project: | Drupal |
| Version: | 6.6 |
| Component: | forms system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
When options are validated, like a set of required radio buttons, an error will be logged when the user submits the form with no radio button selected.
The user gets to see the proper validation message, like "[element title] is required.", which is good.
But at the same time a watchdog error is logged: "Illegal choice [emptry string] in [element title] element.".
For the end user there is no issue here.
For the site administrator, in most cases, this just means extra noise in the watchdog list.
In some cases it can become a real problem though. If you are using a module that emails all errors, like http://drupal.org/project/logging_alerts, for example.
The fix is very easy, when checking for invalid options, first make sure the actual value is not empty. See attached patch.
Also, as a side note, the two watchdog error reports for Illegal Choices are preceded by form_error, where the user is instructed to contact the site administrator. This message never gets shown to the end user for some reason, I could not figure why. Is this because a form_error was already logged against this element?
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| options_validation_error.patch | 715 bytes | Ignored | None | None |

#1
Make sense.
#2
I can see the benefit for having that error message. You should rarely see it, and in the case that it happens, it either means something is going wrong or someone is trying to hack the forms on your site. In both of those cases, I'd want to know.
I can undestand cleaning this message up a little bit, but let's not remove it.
#3
Sorry, but I cannot see any benefit for this error message.
No hacking or anything wrong must happen in order to get this condition.