diff --git sites/all/modules/contrib/apachesolr/apachesolr.module sites/all/modules/contrib/apachesolr/apachesolr.module
index 3b6dc6c..9db3979 100644
--- sites/all/modules/contrib/apachesolr/apachesolr.module
+++ sites/all/modules/contrib/apachesolr/apachesolr.module
@@ -383,9 +383,9 @@ function apachesolr_index_nodes($rows, $namespace) {
   }
 
   // Flatten $documents
-  $tmp = (object) array('a' => array());
-  array_walk_recursive($documents, create_function('&$v, $k, &$t', '$t->a[] = $v;'), $tmp);
-  $documents = $tmp->a;
+  $tmp = array();
+  apachesolr_flatten_documents_array($documents, &$tmp);
+  $documents = $tmp;
 
   if (count($documents)) {
     try {
@@ -429,6 +429,22 @@ function apachesolr_date_iso($date_timestamp) {
   return gmdate('Y-m-d\TH:i:s\Z', $date_timestamp);
 }
 
+/**
+* Function to flatten documents array recursively.
+* @param array $documents The documents array.
+* @param array $tmp The placeholder for the flat array.
+*/
+function apachesolr_flatten_documents_array($documents, &$tmp) {
+  foreach ($documents AS $index => $item) {
+    if (is_array($item)) {
+      apachesolr_flatten_documents_array($item, $tmp);
+    }
+    else {
+      $tmp[] = $item;
+    }
+  }
+}
+
 function apachesolr_delete_node_from_index($node) {
   static $failed = FALSE;
   if ($failed) {
