From 6ad023451adb317c7e0c20d4ef70b957a6da3ba6 Mon Sep 17 00:00:00 2001
From: Neil Drumm <drumm@3064.no-reply.drupal.org>
Date: Wed, 29 Mar 2006 23:29:41 +0000
Subject: [PATCH] #56143 by chx: Non multiple form elements also set to array

---
 includes/form.inc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/includes/form.inc b/includes/form.inc
index 3d5e9497d00c..91698e473d91 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -339,7 +339,12 @@ function form_builder($form_id, $form) {
             $form['#value'] = !empty($edit) ? $form['#return_value'] : 0;
             break;
           case 'select':
-            $form['#value'] = isset($edit) ? $edit : array();
+            if (isset($edit)) {
+              $form['#value'] = $edit;
+            }
+            elseif (isset($form['#multiple']) && $form['#multiple']) {
+              $form['#value'] = array();
+            }
             break;
           case 'textfield':
             if (isset($edit)) {
@@ -874,7 +879,7 @@ function theme_button($element) {
   else {
     $element['#attributes']['class'] = 'form-'. $element['#button_type'];
   }
-  
+
   return '<input type="submit" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
 }
 
-- 
GitLab