Index: common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.476
diff -u -p -r1.476 common.inc
--- common.inc	31 Aug 2005 18:37:30 -0000	1.476
+++ common.inc	7 Sep 2005 21:21:52 -0000
@@ -54,7 +54,7 @@ function drupal_set_content($region = nu
 function drupal_get_content($region = null, $delimiter = ' ') {
   $content = drupal_set_content();
   if (isset($region)) {
-    if (is_array($content[$region])) {
+    if (!empty($content[$region]) && is_array($content[$region])) {
       return implode ($delimiter, $content[$region]);
     }
   }
@@ -186,7 +186,7 @@ function drupal_get_headers() {
  * @see drupal_goto()
  */
 function drupal_get_destination() {
-  if ($_REQUEST['destination']) {
+  if (!empty($_REQUEST['destination'])) {
     return 'destination='. urlencode($_REQUEST['destination']);
   }
   else {
@@ -599,7 +599,7 @@ function locale_initialize() {
     // Useful for e.g. XML/HTML 'lang' attributes.
     $languages = array('en' => 'English');
   }
-  if ($user->uid && $languages[$user->language]) {
+  if (!empty($user->uid) && !empty($languages[$user->language])) {
     return $user->language;
   }
   else {
@@ -1062,7 +1062,7 @@ function form_get_errors() {
  * Return the error message filed against the form with the specified name.
  */
 function _form_get_error($name) {
-  if (array_key_exists('form', $GLOBALS)) {
+  if (array_key_exists("form[$name]", $GLOBALS)) {
     return $GLOBALS['form'][$name];
   }
 }
@@ -1130,6 +1130,8 @@ function form_group($legend, $group, $de
 function form_group_collapsible($legend, $group, $collapsed = FALSE, $description = NULL, $attributes = NULL) {
   drupal_add_js('misc/collapse.js');
 
+  isset($attributes['class']) || $attributes['class'] = '';
+
   $attributes['class'] .= ' collapsible';
   if ($collapsed) {
     $attributes['class'] .= ' collapsed';
