Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.432
diff -u -p -r1.432 form.inc
--- includes/form.inc	12 Feb 2010 15:11:29 -0000	1.432
+++ includes/form.inc	12 Feb 2010 23:33:47 -0000
@@ -1651,7 +1651,10 @@ function form_type_checkboxes_value($ele
     }
     return $value;
   }
-  elseif (!isset($input)) {
+  // If the checkboxes are enabled, and NULL input is submitted, it means
+  // they're intentionally unchecked, so we need to return an empty array to
+  // prevent the default value from being used.
+  elseif (!isset($input) && empty($element['#disabled'])) {
     return array();
   }
 }
@@ -1691,7 +1694,15 @@ function form_type_password_confirm_valu
 function form_type_select_value($element, $input = FALSE) {
   if ($input !== FALSE) {
     if (isset($element['#multiple']) && $element['#multiple']) {
-      return (is_array($input)) ? drupal_map_assoc($input) : array();
+      // If an enabled multi-select submits NULL, it means all items are
+      // unselected. A disabled multi-select always submits NULL, and the
+      // default value should be used.
+      if (empty($element['#disabled'])) {
+        return (is_array($input)) ? drupal_map_assoc($input) : array();
+      }
+      else {
+        return (isset($element['#default_value']) && is_array($element['#default_value'])) ? $element['#default_value'] : array();
+      }
     }
     else {
       return $input;
@@ -1712,7 +1723,7 @@ function form_type_select_value($element
  *   for this element. Return nothing to use the default.
  */
 function form_type_textfield_value($element, $input = FALSE) {
-  if ($input !== FALSE) {
+  if ($input !== FALSE && $input !== NULL) {
     // Equate $input to the form value to ensure it's marked for
     // validation.
     return str_replace(array("\r", "\n"), '', $input);
@@ -2196,6 +2207,7 @@ function form_process_radios($element) {
           '#parents' => $element['#parents'],
           '#id' => drupal_html_id('edit-' . implode('-', $parents_for_id)),
           '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
+          '#disabled' => isset($element['#disabled']) ? $element['#disabled'] : NULL,
         );
       }
     }
@@ -2402,6 +2414,7 @@ function form_process_checkboxes($elemen
           '#default_value' => isset($value[$key]) ? $key : NULL,
           '#attributes' => $element['#attributes'],
           '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
+          '#disabled' => isset($element['#disabled']) ? $element['#disabled'] : NULL,
         );
       }
     }
@@ -2553,6 +2566,7 @@ function form_process_tableselect($eleme
             '#default_value' => isset($value[$key]) ? $key : NULL,
             '#attributes' => $element['#attributes'],
             '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
+            '#disabled' => isset($element['#disabled']) ? $element['#disabled'] : NULL,
           );
         }
         else {
@@ -2568,6 +2582,7 @@ function form_process_tableselect($eleme
             '#parents' => $element['#parents'],
             '#id' => drupal_html_id('edit-' . implode('-', $parents_for_id)),
             '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
+            '#disabled' => isset($element['#disabled']) ? $element['#disabled'] : NULL,
           );
         }
       }
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.196
diff -u -p -r1.196 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	9 Feb 2010 12:28:39 -0000	1.196
+++ modules/simpletest/drupal_web_test_case.php	12 Feb 2010 23:33:50 -0000
@@ -1686,7 +1686,7 @@ class DrupalWebTestCase extends DrupalTe
    */
   protected function handleForm(&$post, &$edit, &$upload, $submit, $form) {
     // Retrieve the form elements.
-    $elements = $form->xpath('.//input|.//textarea|.//select');
+    $elements = $form->xpath('.//input[not(@disabled)]|.//textarea[not(@disabled)]|.//select[not(@disabled)]');
     $submit_matches = FALSE;
     foreach ($elements as $element) {
       // SimpleXML objects need string casting all the time.
Index: modules/simpletest/tests/form.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form.test,v
retrieving revision 1.37
diff -u -p -r1.37 form.test
--- modules/simpletest/tests/form.test	12 Feb 2010 15:11:29 -0000	1.37
+++ modules/simpletest/tests/form.test	12 Feb 2010 23:33:50 -0000
@@ -172,7 +172,7 @@ class FormsTestCase extends DrupalWebTes
           // Checkboxes values are not filtered out.
           $returned_values[$key] = array_filter($returned_values[$key]);
         }
-        $this->assertEqual($expected_value, $returned_values[$key], t('Default value for %type: expected %expected, returned %returned.', array('%type' => $key, '%expected' => var_export($expected_value, TRUE), '%returned' => var_export($returned_values[$key], TRUE))));
+        $this->assertIdentical($expected_value, $returned_values[$key], t('Default value for %type: expected %expected, returned %returned.', array('%type' => $key, '%expected' => var_export($expected_value, TRUE), '%returned' => var_export($returned_values[$key], TRUE))));
       }
     }
   }
Index: modules/translation/translation.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v
retrieving revision 1.23
diff -u -p -r1.23 translation.test
--- modules/translation/translation.test	10 Jan 2010 22:56:51 -0000	1.23
+++ modules/translation/translation.test	12 Feb 2010 23:33:51 -0000
@@ -110,11 +110,14 @@ class TranslationTestCase extends Drupal
         $this->assertRaw(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => $languages[$language_code]->name, '@locale-help' => url('admin/help/locale'))), t('Language has been created.'));
       }
     }
+    elseif ($this->xpath('//input[@type=\'checkbox\' and @name=\'enabled[' . $language_code . ']\' and @checked=\'checked\']')) {
+      // It's installed and enabled. No need to do anything.
+      $this->assertTrue(true, 'Language [' . $language_code . '] already installed and enabled.');
+    }
     else {
-      // Ensure that it is enabled.
+      // It's installed but not enabled. Enable it.
       $this->assertTrue(true, 'Language [' . $language_code . '] already installed.');
       $this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration'));
-
       $this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.'));
     }
   }
