? sites/default/files
? sites/default/settings.php
Index: modules/profile/profile.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v
retrieving revision 1.25
diff -u -p -r1.25 profile.admin.inc
--- modules/profile/profile.admin.inc	26 May 2009 10:41:06 -0000	1.25
+++ modules/profile/profile.admin.inc	24 Jun 2009 17:14:09 -0000
@@ -315,7 +315,7 @@ function profile_field_form_validate($fo
   $query->fields('profile_field', array('fid'));
 
   if (isset($form_state['values']['fid'])) {
-    $query->condition('fid', $form_state['values']['fid']);
+    $query->condition('fid', $form_state['values']['fid'], '<>');
   }
   $query_name = clone $query;
 
@@ -354,9 +354,9 @@ function profile_field_form_submit($form
   if (!isset($form_state['values']['page'])) {
     $form_state['values']['page'] = '';
   }
+  // Remove all elements that are not profile_field columns.
+  $values = array_intersect_key($form_state['values'], array_flip(array('type', 'category', 'title', 'name', 'explanation', 'visibility', 'page', 'weight', 'autocomplete', 'required', 'register', 'options')));
   if (!isset($form_state['values']['fid'])) {
-    // Remove all elements that are not profile_field columns.
-    $values = array_intersect_key($form_state['values'], array_flip(array('type', 'category', 'title', 'name', 'explanation', 'visibility', 'page', 'weight', 'autocomplete', 'required', 'register', 'options')));
     db_insert('profile_field')
       ->fields($values)
       ->execute();
@@ -365,9 +365,9 @@ function profile_field_form_submit($form
   }
   else {
     db_update('profile_field')
-      ->fields($form_state['values'])
+      ->fields($values)
       ->condition('fid', $form_state['values']['fid'])
-      ->exeucte();
+      ->execute();
     drupal_set_message(t('The field has been updated.'));
   }
   cache_clear_all();
Index: modules/profile/profile.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.test,v
retrieving revision 1.14
diff -u -p -r1.14 profile.test
--- modules/profile/profile.test	24 May 2009 17:39:33 -0000	1.14
+++ modules/profile/profile.test	24 Jun 2009 17:14:09 -0000
@@ -68,6 +68,53 @@ class ProfileTestCase extends DrupalWebT
   }
 
   /**
+   * Update a profile field.
+   *
+   * @param $fid
+   *   The fid of the field to be updated.
+   * @param $type
+   *   The type of field to be updated.
+   * @param $edit
+   *   Field parameters to be submitted.
+   * @return
+   *   Array representation of the updated field.
+   */
+  function updateProfileField($fid, $type = 'textfield', $edit = array()) {
+
+    $form_name = $edit['name'];
+    $title = $edit['title'];
+    $category = $edit['category'];
+
+    $this->drupalPost('admin/user/profile/edit/' . $fid, $edit, t('Save field'));
+
+    // Check that the updated field is appearing on the user edit form.
+    $this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category);
+
+    // Checking field.
+    if ($type == 'date') {
+      $this->assertField($form_name . '[month]', t('Found month selection field'));
+      $this->assertField($form_name . '[day]', t('Found day selection field'));
+      $this->assertField($form_name . '[year]', t('Found day selection field'));
+    }
+    else {
+      $this->assertField($form_name , t('Found form named @name', array('@name' => $form_name)));
+    }
+
+    // Checking name.
+    $this->assertText($title, t('Checking title for field %title', array('%title' => $title)));
+    // Checking explanation.
+    $this->assertText($edit['explanation'], t('Checking explanation for field %title', array('%title' => $title)));
+
+    return array(
+      'fid' => $fid,
+      'type' => $type,
+      'form_name' => $form_name,
+      'title' => $title,
+      'category' => $category,
+    );
+  }
+
+  /**
    * Set the profile field to a random value
    *
    * @param $field
@@ -139,10 +186,18 @@ class ProfileTestFields extends ProfileT
       'url' => 'http://www.' . str_replace('_', '', $this->randomName(10)) . '.org',
     );
 
-    // For each field type, create a field, give it a value and delete the field.
+    // For each field type, create a field, give it a value, update the field,
+    // and delete the field.
     foreach ($field_types as $type => $value) {
       $field = $this->createProfileField($type);
       $this->setProfileField($field, $value);
+      $edit = array(
+        'name' => $field['form_name'],
+        'title' => $this->randomName(),
+        'category' => $field['category'],
+        'explanation' => $this->randomName(),
+      );
+      $field = $this->updateProfileField($field['fid'], $field['type'], $edit);
       $this->deleteProfileField($field);
     }
   }
