In edge-case scenarios, #validate and #submit may not be set on a $form.

If another module tries to prepend a form handler in hook_form_alter() using array_unshift() or the like, a PHP warning is thrown.

A potential example for this might be a form that solely uses button-level submit handlers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Could those be located inside the if (!sset()) conditions?

Dave Reid’s picture

Could those be located inside the if (!sset()) conditions?

sun’s picture

Very good suggestion.

sun’s picture

#3: drupal.prepare-form-keys.3.patch queued for re-testing.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense.
Although it's not really that hard a bite, I have been bitten by this before.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x and 7.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.