diff --git a/core/includes/common.inc b/core/includes/common.inc
index 19e0d59..2fa8bdb 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -5928,7 +5928,7 @@ function drupal_render(&$elements) {
   }
 
   // Get the children of the element, sorted by weight.
-  $children = element_children($elements, TRUE);
+  $children = element_children($elements, TRUE, TRUE);
 
   // Initialize this element's #children, unless a #pre_render callback already
   // preset #children.
@@ -6484,7 +6484,7 @@ function element_child($key) {
  * @return
  *   The array keys of the element's children.
  */
-function element_children(&$elements, $sort = FALSE) {
+function element_children(&$elements, $sort = FALSE, $objects = FALSE) {
   // Do not attempt to sort elements which have already been sorted.
   $sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;
 
@@ -6493,7 +6493,7 @@ function element_children(&$elements, $sort = FALSE) {
   $sortable = FALSE;
   foreach ($elements as $key => $value) {
     if ($key === '' || $key[0] !== '#') {
-      if (is_array($value)) {
+      if (is_array($value) || ($objects && ($array_access = $value instanceOf ArrayAccess))) {
         $children[$key] = $value;
         if (isset($value['#weight'])) {
           $sortable = TRUE;
@@ -6501,7 +6501,7 @@ function element_children(&$elements, $sort = FALSE) {
       }
       // Only trigger an error if the value is not null.
       // @see http://drupal.org/node/1283892
-      elseif (isset($value)) {
+      elseif (isset($value) && (!$objects || !$array_access)) {
         trigger_error(t('"@key" is an invalid render array key', array('@key' => $key)), E_USER_ERROR);
       }
     }
