Index: sites/all/modules/webform/components/select.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/webform/components/select.inc,v
retrieving revision 1.23
diff -u -p -r1.23 select.inc
--- sites/all/modules/webform/components/select.inc	05 May 2009 22:38:14 -0000
+++ sites/all/modules/webform/components/select.inc	14 May 2009 15:39:54 -0000
function _webform_select_options($text, $flat = FALSE) {
  $options = array();
  $rows = array_filter(explode("\n", trim($text)));
  $group = NULL;
  foreach ($rows as $option) {
    $option = trim($option);
    /**
     * If the Key of the option is within < >, treat as an optgroup
     *
     * <Group 1>
     *   creates an optgroup with the label "Group 1"
     *
     * <>
     *   Unsets the current group, allowing items to be inserted at the root element.
     */

    if (preg_match('/^\<([^>]*)\>$/', $option, $matches)) {
      if (empty($matches[1])) {
        unset($group);
      }
      elseif (!$flat) {
        $group = _webform_filter_values($matches[1], NULL, NULL, FALSE);
      }
    }
    elseif (preg_match('/^([^|]+)\|(.*)$/', $option, $matches)) {
-     $key = _webform_filter_values($matches[1], NULL, NULL, FALSE);
+     $key = _webform_filter_values($matches[1], NULL, NULL, FALSE);
      $value = _webform_filter_values($matches[2], NULL, NULL, FALSE);
      isset($group) ? $options[$group][$key] = $value : $options[$key] = $value;
    }
    else {
      $filtered_option = _webform_filter_values($option, NULL, NULL, FALSE);
-     isset($group) ? $options[$group][$filtered_option] = $filtered_option : $options[$filtered_option] = $filtered_option;
+     isset($group) ? $options[$group][$filtered_option] = $filtered_option : $options[_webform_safe_name($filtered_option)] = $filtered_option;
    }
  }
  return $options;
}
