diff options
author | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-04-02 13:07:00 +0000 |
---|---|---|
committer | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-04-02 13:07:00 +0000 |
commit | 3a84ed2a90ab56b2563dd09f157131e45a0fe32f (patch) | |
tree | e94de163544cf81a587e2d48350aad3abcce6feb /includes | |
parent | 767ed120d5f968cfa681b163292fc5f8f80617a4 (diff) | |
download | brdo-3a84ed2a90ab56b2563dd09f157131e45a0fe32f.tar.gz brdo-3a84ed2a90ab56b2563dd09f157131e45a0fe32f.tar.bz2 |
#56921, break up references in _validate, patch by chx
Diffstat (limited to 'includes')
-rw-r--r-- | includes/form.inc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/form.inc b/includes/form.inc index 91698e473..e11277391 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -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) { + unset($form_values[$k]); + $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 |