Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.416
diff -u -9 -p -r1.416 form.inc
--- includes/form.inc	5 Dec 2009 16:03:51 -0000	1.416
+++ includes/form.inc	8 Dec 2009 22:25:39 -0000
@@ -1859,20 +1859,22 @@ function theme_fieldset($variables) {
  *
  * @ingroup themeable
  */
 function theme_radio($variables) {
   $element = $variables['element'];
   _form_set_class($element, array('form-radio'));
   $output = '<input type="radio" ';
   $output .= 'id="' . $element['#id'] . '" ';
   $output .= 'name="' . $element['#name'] . '" ';
-  $output .= 'value="' . $element['#return_value'] . '" ';
-  $output .= (check_plain($element['#value']) == $element['#return_value']) ? ' checked="checked" ' : ' ';
+  $output .= 'value="' . check_plain($element['#return_value']) . '" ';
+  if ((string)$element['#value'] == (string)$element['#return_value']) {
+    $output .= 'checked="checked" ';
+  }
   $output .= drupal_attributes($element['#attributes']) . ' />';
 
   return $output;
 }
 
 /**
  * Theme a set of radio button form elements.
  *
  * @param $variables
@@ -2066,19 +2068,19 @@ function form_process_radios($element) {
   if (count($element['#options']) > 0) {
     foreach ($element['#options'] as $key => $choice) {
       if (!isset($element[$key])) {
         // Generate the parents as the autogenerator does, so we will have a
         // unique id for each radio button.
         $parents_for_id = array_merge($element['#parents'], array($key));
         $element[$key] = array(
           '#type' => 'radio',
           '#title' => $choice,
-          '#return_value' => check_plain($key),
+          '#return_value' => $key,
           '#default_value' => isset($element['#default_value']) ? $element['#default_value'] : NULL,
           '#attributes' => $element['#attributes'],
           '#parents' => $element['#parents'],
           '#id' => drupal_html_id('edit-' . implode('-', $parents_for_id)),
           '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
         );
       }
     }
   }
@@ -2205,21 +2207,21 @@ function theme_text_format_wrapper($vari
  */
 function theme_checkbox($variables) {
   $element = $variables['element'];
   $t = get_t();
   _form_set_class($element, array('form-checkbox'));
   $checkbox = '<input ';
   $checkbox .= 'type="checkbox" ';
   $checkbox .= 'name="' . $element['#name'] . '" ';
   $checkbox .= 'id="' . $element['#id'] . '" ' ;
-  $checkbox .= 'value="' . $element['#return_value'] . '" ';
+  $checkbox .= 'value="' . check_plain($element['#return_value']) . '" ';
   // Unchecked checkbox has #value of numeric 0.
-  if ($element['#value'] !== 0 && $element['#value'] == $element['#return_value']) {
+  if ($element['#value'] !== 0 && (string)$element['#value'] == (string)$element['#return_value']) {
     $checkbox .= 'checked="checked" ';
   }
   $checkbox .= drupal_attributes($element['#attributes']) . ' />';
 
   return $checkbox;
 }
 
 /**
  * Theme a set of checkbox form elements.
@@ -2274,20 +2276,21 @@ function form_process_checkboxes($elemen
     if (!isset($element['#default_value']) || $element['#default_value'] == 0) {
       $element['#default_value'] = array();
     }
     foreach ($element['#options'] as $key => $choice) {
       if (!isset($element[$key])) {
         $element[$key] = array(
           '#type' => 'checkbox',
           '#processed' => TRUE,
           '#title' => $choice,
-          '#return_value' => $key,
-          '#default_value' => isset($value[$key]) ? $key : NULL,
+          '#return_value' => (string)$key,
+          '#name' => $element['#name'] . '[' . check_plain($key) . ']',
+          '#default_value' => isset($value[$key]) ? (string)$key : NULL,
           '#attributes' => $element['#attributes'],
           '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
         );
       }
     }
   }
   return $element;
 }
 
Index: modules/field/modules/options/options.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.module,v
retrieving revision 1.19
diff -u -9 -p -r1.19 options.module
--- modules/field/modules/options/options.module	4 Dec 2009 16:49:46 -0000	1.19
+++ modules/field/modules/options/options.module	8 Dec 2009 22:25:40 -0000
@@ -48,51 +48,47 @@ function options_field_widget_info() {
 
 /**
  * Implements hook_field_widget().
  */
 function options_field_widget(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
   // Abstract over the actual field columns, to allow different field types to
   // reuse those widgets.
   $value_key = key($field['columns']);
   $multiple = $field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED;
-  // Form API 'checkboxes' do not suport 0 as an option, so we replace it with
-  // a placeholder within the form workflow.
-  $zero_placeholder = $instance['widget']['type'] == 'options_buttons' && $multiple;
   // Collect available options for the field.
-  $options = options_get_options($field, $instance, $zero_placeholder);
+  $options = options_get_options($field, $instance);
   // Put current field values in shape.
-  $default_value = _options_storage_to_form($items, $options, $value_key, $zero_placeholder);
+  $default_value = _options_storage_to_form($items, $options, $value_key);
 
   switch ($instance['widget']['type']) {
     case 'options_select':
       $element += array(
         '#type' => 'select',
         '#default_value' => $default_value,
         // Do not display a 'multiple' select box if there is only one option.
         '#multiple' => $multiple && count($options) > 1,
         '#options' => $options,
         '#value_key' => $value_key,
         '#element_validate' => array('options_field_widget_validate'),
       );
       break;
 
     case 'options_buttons':
       $type = $multiple ? 'checkboxes' : 'radios';
       // If required and there is one single option, preselect it.
       if ($element['#required'] && count($options) == 1) {
-        $default_value = array(key($options));
+        $default_value = array((string)key($options));
       }
       $element += array(
         '#type' => $type,
         // Radio buttons need a scalar value.
         '#default_value' => ($type == 'radios') ? reset($default_value) : $default_value,
         '#options' => $options,
-        '#zero_placeholder' => $zero_placeholder,
         '#value_key' => $value_key,
         '#element_validate' => array('options_field_widget_validate'),
       );
       break;
 
     case 'options_onoff':
       $keys = array_keys($options);
       $off_value = (!empty($keys) && isset($keys[0])) ? $keys[0] : NULL;
       $on_value = (!empty($keys) && isset($keys[1])) ? $keys[1] : NULL;
@@ -128,87 +124,60 @@ function options_field_widget_validate($
     if (count($items) > $field['cardinality']) {
       form_error($element, t('%name: this field cannot hold more than @count values.', array('%name' => t($instance['label']), '@count' => $field['cardinality'])));
     }
   }
 }
 
 /**
  * Prepares the options for a field.
  */
-function options_get_options($field, $instance, $zero_placeholder) {
+function options_get_options($field, $instance) {
   // Check if there is a module hook for the option values, otherwise try
   // list_allowed_values() for an options list.
   // @todo This should be turned into a hook_options_allowed_values(), exposed
   // by options.module.
   $function = $field['module'] . '_allowed_values';
   $options = function_exists($function) ? $function($field) : (array) list_allowed_values($field);
 
-  // Substitute the '_0' placeholder.
-  if ($zero_placeholder) {
-    $values = array_keys($options);
-    // Use a strict comparison, because 0 == 'any string'.
-    $index = array_search(0, $values, TRUE);
-    if ($index !== FALSE) {
-      $values[$index] = '_0';
-      $options = array_combine($values, array_values($options));
-    }
-  }
-
   // Add an empty choice for
   // - non required radios
   // - non required selects
   if (!$instance['required']) {
     if (($instance['widget']['type'] == 'options_buttons' && ($field['cardinality'] == 1)) || ($instance['widget']['type'] == 'options_select')) {
       $options = array('_none' => theme('options_none', array('instance' => $instance))) + $options;
     }
   }
   return $options;
 }
 
 /**
  * Transforms stored field values into the format the widgets need.
  */
-function _options_storage_to_form($items, $options, $column, $zero_placeholder) {
+function _options_storage_to_form($items, $options, $column) {
   $items_transposed = options_array_transpose($items);
   $values = (isset($items_transposed[$column]) && is_array($items_transposed[$column])) ? $items_transposed[$column] : array();
 
-  // Substitute the '_0' placeholder.
-  if ($zero_placeholder) {
-    $index = array_search('0', $values);
-    if ($index !== FALSE) {
-      $values[$index] = '_0';
-    }
-  }
-
   // Discard values that are not in the current list of options.
   $values = array_values(array_intersect($values, array_keys($options)));
   return $values;
 }
 
 /**
  * Transforms submitted form values into field storage format.
  */
 function _options_form_to_storage($element) {
   $values = array_values((array) $element['#value']);
 
   // On/off checkbox: transform '0 / 1' into the 'on / off' values.
   if ($element['#type'] == 'checkbox') {
     $values = array($values[0] ? $element['#on_value'] : $element['#off_value']);
   }
 
-  // Substitute the '_0' placeholder.
-  if (!empty($element['#zero_placeholder'])) {
-    $index = array_search('_0', $values);
-    if ($index !== FALSE) {
-      $values[$index] = 0;
-    }
-  }
-
   // Filter out the 'none' option. Use a strict comparison, because
   // 0 == 'any string'.
   $index = array_search('_none', $values, TRUE);
   if ($index !== FALSE) {
     unset($values[$index]);
   }
 
   // Make sure we populate at least an empty value.
   if (empty($values)) {
Index: modules/field/modules/options/options.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/field/modules/options/options.test,v
retrieving revision 1.6
diff -u -9 -p -r1.6 options.test
--- modules/field/modules/options/options.test	2 Dec 2009 19:26:21 -0000	1.6
+++ modules/field/modules/options/options.test	8 Dec 2009 22:25:40 -0000
@@ -128,64 +128,64 @@ class OptionsWidgetsTestCase extends Dru
 
     // Create an entity.
     $entity_init = field_test_create_stub_entity();
     $entity = clone $entity_init;
     $entity->is_new = TRUE;
     field_test_entity_save($entity);
 
     // Display form: with no field data, nothing is checked.
     $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
-    $this->assertNoFieldChecked("edit-card-2-$langcode--0");
+    $this->assertNoFieldChecked("edit-card-2-$langcode-0");
     $this->assertNoFieldChecked("edit-card-2-$langcode-1");
     $this->assertNoFieldChecked("edit-card-2-$langcode-2");
 
     // Submit form: select first and third options.
     $edit = array(
-      "card_2[$langcode][_0]" => TRUE,
+      "card_2[$langcode][0]" => TRUE,
       "card_2[$langcode][1]" => FALSE,
       "card_2[$langcode][2]" => TRUE,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertListValues($entity_init, 'card_2', $langcode, array(0, 2));
 
     // Display form: check that the right options are selected.
     $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
-    $this->assertFieldChecked("edit-card-2-$langcode--0");
+    $this->assertFieldChecked("edit-card-2-$langcode-0");
     $this->assertNoFieldChecked("edit-card-2-$langcode-1");
     $this->assertFieldChecked("edit-card-2-$langcode-2");
 
     // Submit form: select only first option.
     $edit = array(
-      "card_2[$langcode][_0]" => TRUE,
+      "card_2[$langcode][0]" => TRUE,
       "card_2[$langcode][1]" => FALSE,
       "card_2[$langcode][2]" => FALSE,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertListValues($entity_init, 'card_2', $langcode, array(0));
 
     // Display form: check that the right options are selected.
     $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
-    $this->assertFieldChecked("edit-card-2-$langcode--0");
+    $this->assertFieldChecked("edit-card-2-$langcode-0");
     $this->assertNoFieldChecked("edit-card-2-$langcode-1");
     $this->assertNoFieldChecked("edit-card-2-$langcode-2");
 
     // Submit form: select the three options while the field accepts only 2.
     $edit = array(
-      "card_2[$langcode][_0]" => TRUE,
+      "card_2[$langcode][0]" => TRUE,
       "card_2[$langcode][1]" => TRUE,
       "card_2[$langcode][2]" => TRUE,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     $this->assertText('this field cannot hold more than 2 values', t('Validation error was displayed.'));
 
     // Submit form: uncheck all options.
     $edit = array(
-      "card_2[$langcode][_0]" => FALSE,
+      "card_2[$langcode][0]" => FALSE,
       "card_2[$langcode][1]" => FALSE,
       "card_2[$langcode][2]" => FALSE,
     );
     $this->drupalPost(NULL, $edit, t('Save'));
     // Check that the value was saved.
     $this->assertListValues($entity_init, 'card_2', $langcode, array());
 
     // Required checkbox with one option is auto-selected.
     $this->card_2['settings']['allowed_values'] = '99|Only allowed value';
Index: modules/simpletest/simpletest.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.pages.inc,v
retrieving revision 1.20
diff -u -9 -p -r1.20 simpletest.pages.inc
--- modules/simpletest/simpletest.pages.inc	8 Nov 2009 13:23:41 -0000	1.20
+++ modules/simpletest/simpletest.pages.inc	8 Dec 2009 22:25:40 -0000
@@ -179,19 +179,19 @@ function _simpletest_sort_by_title($a, $
 }
 
 /**
  * Run selected tests.
  */
 function simpletest_test_form_submit($form, &$form_state) {
   // Get list of tests.
   $tests_list = array();
   foreach ($form_state['values'] as $class_name => $value) {
-    if (class_exists($class_name) && $value === 1) {
+    if (class_exists($class_name) && $value == 1) {
       $tests_list[] = $class_name;
     }
   }
   if (count($tests_list) > 0 ) {
     simpletest_run_tests($tests_list, 'drupal');
   }
   else {
     drupal_set_message(t('No test(s) selected.'), 'error');
   }
