#1 - formsapi does not check to match form_id value between $_POST['edit'] and the form_id of the form being built. This can cause values from the posted form to populate an unrelated form's fields if the names are the same. This also causes the form_id of a posted form to replace the form_id of any form on the destination page. This is bad. This patch adds $form_id to the parameters for _form_builder, so we check to make sure that $_POST['edit']['form_id'] matches with it before populating from $_POST['edit'].

#2 - formsapi validation happens based on a comparison of $form_fields['form_id'] with $callback and $form_id to determine if it should validate. However, $form_fields['form_id'] changes with every _form_builder call to the current form, so this always validates as TRUE, causing every form being rendered to validate against the $_POST['edit'] data. This patch changes it to compare against $_POST['edit']['form_id'] instead of $form_fields['form_id'] so only the posted form is validated against $_POST['edit'].

CommentFileSizeAuthor
form.inc_1.patch1.9 KBcrunchywelch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adrian’s picture

+1 it's definitely critical and required.

Steven’s picture

Status: Needs review » Fixed

Committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)