Index: index.php =================================================================== RCS file: /cvs/drupal/drupal/index.php,v retrieving revision 1.82 diff -u -F^f -r1.82 index.php --- index.php 21 Aug 2004 06:42:34 -0000 1.82 +++ index.php 12 Apr 2005 21:21:22 -0000 @@ -14,6 +14,7 @@ include_once 'includes/common.inc'; fix_gpc_magic(); +fix_checkboxes(); $status = menu_execute_active_handler(); switch ($status) { Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.437 diff -u -F^f -r1.437 common.inc --- includes/common.inc 11 Apr 2005 22:48:27 -0000 1.437 +++ includes/common.inc 12 Apr 2005 21:21:24 -0000 @@ -413,6 +413,20 @@ function fix_gpc_magic() { } /** + * Empty arrays can not be posted through HTML. So we check and fix empty + * form_checkboxes. + */ +function fix_checkboxes() { + if (isset($_POST['form_checkboxes'])) { + foreach ($_POST['form_checkboxes'] as $key) { + if (!array_key_exists($key, $_POST['edit'])) { + $_POST['edit'][$key] = array(); + } + } + } +} + +/** * @name Conversion * @{ * Converts data structures to different types. @@ -1177,9 +1191,8 @@ function form_checkboxes($title, $name, $choices .= '
'; } // Note: because unchecked boxes are not included in the POST data, we - // include a form_hidden() which will be overwritten as soon as there is at - // least one checked box. - return form_hidden($name, 0) . theme('form_element', $title, $choices, $description, NULL, $required, _form_get_error($name)); + // indicate that $name is a form_checkbox. + return '' . theme('form_element', $title, $choices, $description, NULL, $required, _form_get_error($name)); } }