Page MenuHomePhabricator

HTMLForm should give warning if a field is used requring setFormIdentifier() but it isn't used
Open, Needs TriagePublic

Description

If a form uses the GET method, and has a checkbox or HTMLMultiSelect with a default value of true, then it is required that the htmlform have ->setFormIdentifier called on it. If you do not do this, this, it is impossible to de-select all checkboxes

This is really confusing, and easy to miss. We should check if the form is using one of these fields, and has a true default value, and if so, and no identifier is set, we should log a warning, or perhaps even throw an exception. Alternatively, maybe we could just use a random value or the empty string for the form identifier, if not set and needed (If mFormIdentifier is null, all the other behaviours of it are skipped, so i think this should be fairly safe).

See T321154 for an example of a bug caused by this.