? logs
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.115.2.3
diff -u -p -r1.115.2.3 module.inc
--- includes/module.inc	16 Nov 2009 17:17:35 -0000	1.115.2.3
+++ includes/module.inc	11 Feb 2010 17:53:12 -0000
@@ -481,11 +481,26 @@ function module_invoke_all() {
   foreach (module_implements($hook) as $module) {
     $function = $module .'_'. $hook;
     $result = call_user_func_array($function, $args);
-    if (isset($result) && is_array($result)) {
-      $return = array_merge_recursive($return, $result);
-    }
-    else if (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;
+      }
     }
   }
 
