=== modified file 'includes/form.inc'
--- includes/form.inc	
+++ includes/form.inc	
@@ -640,7 +657,7 @@ function form_select_options($element, $
   $value_valid = isset($element['#value']) || array_key_exists('#value', $element);
   $value_is_array = is_array($element['#value']);
   $options = '';
-  foreach ($choices as $key => $choice) {
+  foreach ((array)$choices as $key => $choice) {
     if (is_array($choice)) {
       $options .= '<optgroup label="'. $key .'">';
       $options .= form_select_options($element, $choice);
