Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.180
diff -u -p -r1.180 module.inc
--- includes/module.inc	28 Jan 2010 13:56:24 -0000	1.180
+++ includes/module.inc	11 Feb 2010 17:52:19 -0000
@@ -619,8 +619,24 @@ function module_hook_info() {
         $function = $module . '_hook_info';
         if (function_exists($function)) {
           $result = $function();
-          if (isset($result) && is_array($result)) {
-            $hook_info = array_merge_recursive($hook_info, $result);
+          // If a result was returned, process it.
+          if (isset($result)) {
+            // If the return is an array, handle it specially.
+            if (is_array($result)) {
+              // Only proceed if the array is not empty.
+              if (!empty($result)) {
+                // If $hook_info is currently empty, just assign the result to
+                // it.
+                if (empty($return)) {
+                  $hook_info = $result;
+                }
+                // The $hook_info array was not empty so merge the result
+                // values.
+                else {
+                  $hook_info = array_merge_recursive($hook_info, $result);
+                }
+              }
+            }
           }
         }
       }
@@ -698,11 +714,26 @@ function module_invoke_all() {
     $function = $module . '_' . $hook;
     if (function_exists($function)) {
       $result = call_user_func_array($function, $args);
-      if (isset($result) && is_array($result)) {
-        $return = array_merge_recursive($return, $result);
-      }
-      elseif (isset($result)) {
-        $return[] = $result;
+      // If a result was returned, process it.
+      if (isset($result)) {
+        // If the return is an array, handle it specially.
+        if (is_array($result)) {
+          // Only proceed if the array was not empty.
+          if (!empty($result)) {
+            // If the return is currently empty, just assign the result to it.
+            if (empty($return)) {
+              $return = $result;
+            }
+            // The return array was not empty to merge the result values.
+            else {
+              $return = array_merge_recursive($return, $result);
+            }
+          }
+        }
+        // Non-array results are appended to the return array.
+        else {
+          $return[] = $result;
+        }
       }
     }
   }
