Commit 3a84ed2a authored by Gerhard Killesreiter's avatar Gerhard Killesreiter
Browse files

#56921, break up references in _validate, patch by chx

parent 767ed120
......@@ -157,6 +157,15 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
function drupal_validate_form($form_id, &$form, $callback = NULL) {
global $form_values;
// we need a copy of form_values otherwise foreach falls into an infite loop
$copy = (array)$form_values;
// this loop breaks the references in form_values thus makes it impossible for
// validate functions to modify the $form_values array
foreach ($copy as $k => $v) {
$form_values[$k] = $v;
if (isset($form['#token'])) {
if ($form_values['form_token'] != md5(session_id() . $form['#token'] . variable_get('drupal_private_key', ''))) {
// setting this error will cause the form to fail validation
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment