Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.498
diff -u -p -r1.498 form.inc
--- includes/form.inc	1 Oct 2010 22:28:55 -0000	1.498
+++ includes/form.inc	2 Oct 2010 01:06:28 -0000
@@ -2307,14 +2307,23 @@ function _form_options_flatten($array) {
  *     Whether this first option is a valid option depends on whether the field
  *     is #required or not.
  *   - #required: (optional) Whether the user needs to select an option (TRUE)
- *     or not (FALSE). Defaults to TRUE.
+ *     or not (FALSE). Defaults to FALSE.
  *   - #empty_option: (optional) The label to show for the first default option.
  *     By default, the label is automatically set to "- Please select -" for a
  *     required field and "- None -" for an optional field.
  *   - #empty_value: (optional) The value for the first default option, which is
- *     used to determine whether the user submitted a value or not. Defaults to
- *     '' (an empty string). To be used in case the field is optional and the
- *     empty default value should have a special value (e.g., a constant).
+ *     used to determine whether the user submitted a value or not.
+ *     - If #required is TRUE, this defaults to '' (an empty string).
+ *     - If #required is not TRUE and this value isn't set, then no extra option
+ *       is added to the select control, leaving the control in a slightly
+ *       illogical state, because there's no way for the user to select nothing,
+ *       since all user agents automatically preselect the first available
+ *       option. But people are used to this being the behavior of select
+ *       controls.
+ *       @todo Address the above issue in Drupal 8.
+ *     - If #required is not TRUE and this value is set (most commonly to an
+ *       empty string), then an extra option (see #empty_option above)
+ *       representing a "non-selection" is added with this as its value.
  *
  * @see _form_validate()
  */
@@ -2323,56 +2332,31 @@ function form_process_select($element) {
   if ($element['#multiple']) {
     $element['#attributes']['multiple'] = 'multiple';
     $element['#attributes']['name'] = $element['#name'] . '[]';
-    // If not explicitly set, #required has to default to FALSE (see below).
-    if (!isset($element['#required'])) {
-      $element['#required'] = FALSE;
-    }
   }
   // A non-#multiple select needs special handling to prevent user agents from
   // preselecting the first option without intention. #multiple select lists do
   // not get an empty option, as it would not make sense, user interface-wise.
   else {
     $add_empty_option = FALSE;
-    // Select elements always have a value in HTML, so the expectation is that
-    // the user has to choose an option. Therefore, a select element is set to
-    // #required TRUE, unless it has been explicitly set to FALSE. This differs
-    // from every other element which gets a default of #required FALSE via
-    // form_builder(). To avoid this default, system_element_info() sets
-    // #required to NULL.
-    // If #required has been explicitly set to FALSE, the user may optionally
-    // choose an option, which can be "None".
-    if (isset($element['#required']) && !$element['#required']) {
-      $element['#required'] = FALSE;
+    // If the element is not required and there's a value for #empty_value, then
+    // add an option that represents emptiness.
+    if (!$element['#required'] && isset($element['#empty_value'])) {
       $element += array(
-        '#empty_value' => '',
         '#empty_option' => t('- None -'),
       );
       $add_empty_option = TRUE;
     }
-    // Otherwise, if #required is TRUE (or not set) and there is no
-    // #default_value, then the user has to choose an option, which makes this
-    // element #required.
-    elseif (!isset($element['#default_value'])) {
-      // By only conditionally setting #required to TRUE, we additionally ensure
-      // that the select element does not get a required marker if it already
-      // has a value.
-      $element['#required'] = TRUE;
+    // If the element is required and there is no #default_value, then add an
+    // empty option that will fail validation, so that the user is required to
+    // make a choice.
+    elseif ($element['#required'] && !isset($element['#default_value'])) {
       $element += array(
         '#empty_value' => '',
         '#empty_option' => t('- Select -'),
       );
       $add_empty_option = TRUE;
     }
-    // If there is a #default_value and #required is not explicitly FALSE, then
-    // there is no point in adding an empty option which is never valid, and we
-    // just retain API compatibility.
-    if (!isset($element['#required'])) {
-      $element['#required'] = FALSE;
-    }
-    // If one of the above conditions is met, add a first empty default option,
-    // which is always invalid for #required select lists that do not specify a
-    // #default_value.
-    // @see _form_validate()
+    // Add the empty option if needed.
     if ($add_empty_option) {
       // The empty option is prepended to #options and purposively not merged
       // to prevent another option in #options mistakenly using the same value
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.350
diff -u -p -r1.350 filter.module
--- modules/filter/filter.module	29 Sep 2010 20:12:51 -0000	1.350
+++ modules/filter/filter.module	2 Oct 2010 01:06:32 -0000
@@ -827,6 +827,7 @@ function filter_process_format($element)
   $element['format']['format'] = array(
     '#type' => 'select',
     '#title' => t('Text format'),
+    '#required' => TRUE,
     '#options' => $options,
     '#default_value' => $element['#format'],
     '#access' => count($formats) > 1,
Index: modules/simpletest/tests/form.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form.test,v
retrieving revision 1.71
diff -u -p -r1.71 form.test
--- modules/simpletest/tests/form.test	1 Oct 2010 22:28:55 -0000	1.71
+++ modules/simpletest/tests/form.test	2 Oct 2010 01:06:36 -0000
@@ -164,6 +164,8 @@ class FormsTestCase extends DrupalWebTes
     // Posting without any values should throw validation errors.
     $this->drupalPost(NULL, array(), 'Submit');
     $this->assertNoText(t($error, array('!name' => $form['select']['#title'])));
+    $this->assertNoText(t($error, array('!name' => $form['select_required']['#title'])));
+    $this->assertNoText(t($error, array('!name' => $form['select_optional']['#title'])));
     $this->assertNoText(t($error, array('!name' => $form['empty_value']['#title'])));
     $this->assertNoText(t($error, array('!name' => $form['empty_value_one']['#title'])));
     $this->assertText(t($error, array('!name' => $form['no_default']['#title'])));
Index: modules/simpletest/tests/form_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/form_test.module,v
retrieving revision 1.50
diff -u -p -r1.50 form_test.module
--- modules/simpletest/tests/form_test.module	27 Sep 2010 00:53:56 -0000	1.50
+++ modules/simpletest/tests/form_test.module	2 Oct 2010 01:06:36 -0000
@@ -789,19 +789,32 @@ function form_test_select($form, &$form_
     '#title' => '#default_value one',
     '#default_value' => 'one',
   );
+  $form['select_required'] = $base + array(
+    '#title' => '#default_value one, #required',
+    '#required' => TRUE,
+    '#default_value' => 'one',
+  );
+  $form['select_optional'] = $base + array(
+    '#title' => '#default_value one, not #required',
+    '#required' => FALSE,
+    '#default_value' => 'one',
+  );
   $form['empty_value'] = $base + array(
-    '#title' => '#default_value one, #empty_value 0',
+    '#title' => '#default_value one, #required, #empty_value 0',
+    '#required' => TRUE,
     '#default_value' => 'one',
     '#empty_value' => 0,
   );
   $form['empty_value_one'] = $base + array(
-    '#title' => '#default_value = #empty_value',
+    '#title' => '#default_value = #empty_value, #required',
+    '#required' => TRUE,
     '#default_value' => 'one',
     '#empty_value' => 'one',
   );
 
   $form['no_default'] = $base + array(
-    '#title' => 'No #default_value',
+    '#title' => 'No #default_value, #required',
+    '#required' => TRUE,
   );
   $form['no_default_optional'] = $base + array(
     '#title' => 'No #default_value, not #required',
@@ -810,7 +823,8 @@ function form_test_select($form, &$form_
   );
 
   $form['no_default_empty_option'] = $base + array(
-    '#title' => 'No #default_value, #empty_option',
+    '#title' => 'No #default_value, #required, #empty_option',
+    '#required' => TRUE,
     '#empty_option' => '- Choose -',
   );
   $form['no_default_empty_option_optional'] = $base + array(
@@ -821,12 +835,14 @@ function form_test_select($form, &$form_
   );
 
   $form['no_default_empty_value'] = $base + array(
-    '#title' => 'No #default_value, #empty_value 0',
+    '#title' => 'No #default_value, #required, #empty_value 0',
+    '#required' => TRUE,
     '#empty_value' => 0,
     '#description' => 'Should never result in 0.',
   );
   $form['no_default_empty_value_one'] = $base + array(
-    '#title' => 'No #default_value, #empty_value one',
+    '#title' => 'No #default_value, #required, #empty_value one',
+    '#required' => TRUE,
     '#empty_value' => 'one',
     '#description' => 'A mistakenly assigned #empty_value contained in #options should not be valid.',
   );
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.969
diff -u -p -r1.969 system.module
--- modules/system/system.module	1 Oct 2010 18:37:23 -0000	1.969
+++ modules/system/system.module	2 Oct 2010 01:06:37 -0000
@@ -399,11 +399,6 @@ function system_element_info() {
   );
   $types['select'] = array(
     '#input' => TRUE,
-    // In order to be able to determine whether a select list needs an empty
-    // default option, #required has to be NULL by default, as form_builder()
-    // preemptively sets #required to FALSE for all elements.
-    // @see form_process_select()
-    '#required' => NULL,
     '#multiple' => FALSE,
     '#process' => array('form_process_select', 'ajax_process_form'),
     '#theme' => 'select',
