=== modified file 'includes/form.inc'
--- includes/form.inc	
+++ includes/form.inc	
@@ -157,6 +157,15 @@ function drupal_get_form($form_id, &$for
 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($GLOBALS['form_values'][$k]);
+    $GLOBALS['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
