Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.69
diff -u -p -r1.69 filter.admin.inc
--- modules/filter/filter.admin.inc	22 Oct 2010 16:36:14 -0000	1.69
+++ modules/filter/filter.admin.inc	30 Nov 2010 03:52:48 -0000
@@ -308,8 +308,11 @@ function filter_admin_format_form_submit
   // Remove unnecessary values.
   form_state_values_clean($form_state);
 
-  // Save text format.
-  $format = (object) $form_state['values'];
+  // Add the submitted form values to the text format, and save it.
+  $format = $form['#format'];
+  foreach ($form_state['values'] as $key => $value) {
+    $format->$key = $value;
+  }
   $status = filter_format_save($format);
 
   // Save user permissions.
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.359
diff -u -p -r1.359 filter.module
--- modules/filter/filter.module	21 Nov 2010 09:16:54 -0000	1.359
+++ modules/filter/filter.module	30 Nov 2010 03:52:48 -0000
@@ -173,6 +173,8 @@ function filter_format_load($format_id) 
  *     to save. If this corresponds to an existing text format, that format
  *     will be updated; otherwise, a new format will be created.
  *   - 'name': The title of the text format.
+ *   - 'status': (optional) An integer indicating whether the text format is
+ *     enabled (1) or not (0). Defaults to 1.
  *   - 'weight': (optional) The weight of the text format, which controls its
  *     placement in text format lists. If omitted, the weight is set to 0.
  *   - 'filters': (optional) An associative, multi-dimensional array of filters
Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.81
diff -u -p -r1.81 filter.test
--- modules/filter/filter.test	29 Nov 2010 06:38:51 -0000	1.81
+++ modules/filter/filter.test	30 Nov 2010 03:52:48 -0000
@@ -185,22 +185,36 @@ class FilterAdminTestCase extends Drupal
     // Add text format.
     $this->drupalGet('admin/config/content/formats');
     $this->clickLink('Add text format');
+    $format_id = drupal_strtolower($this->randomName());
+    $name = $this->randomName();
     $edit = array(
-      'format' => drupal_strtolower($this->randomName()),
-      'name' => $this->randomName(),
+      'format' => $format_id,
+      'name' => $name,
     );
     $this->drupalPost(NULL, $edit, t('Save configuration'));
 
+    // Verify default weight of the text format.
+    $this->drupalGet('admin/config/content/formats');
+    $this->assertFieldByName("formats[$format_id][weight]", 0, t('Text format weight was saved.'));
+
+    // Change the weight of the text format.
+    $edit = array(
+      "formats[$format_id][weight]" => 5,
+    );
+    $this->drupalPost('admin/config/content/formats', $edit, t('Save changes'));
+    $this->assertFieldByName("formats[$format_id][weight]", 5, t('Text format weight was saved.'));
+
     // Edit text format.
-    $format_id = $edit['format'];
-    $name = $edit['name'];
     $this->drupalGet('admin/config/content/formats');
     $this->assertLinkByHref('admin/config/content/formats/' . $format_id);
     $this->drupalGet('admin/config/content/formats/' . $format_id);
     $this->drupalPost(NULL, array(), t('Save configuration'));
 
-    // Disable text format.
+    // Verify that the custom weight of the text format has been retained.
     $this->drupalGet('admin/config/content/formats');
+    $this->assertFieldByName("formats[$format_id][weight]", 5, t('Text format weight was retained.'));
+
+    // Disable text format.
     $this->assertLinkByHref('admin/config/content/formats/' . $format_id . '/disable');
     $this->drupalGet('admin/config/content/formats/' . $format_id . '/disable');
     $this->drupalPost(NULL, array(), t('Disable'));
