diff --git a/core/includes/common.inc b/core/includes/common.inc
index ee399a4..a4da21b 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3787,7 +3787,7 @@ function _drupal_render_process_post_render_cache(array &$elements) {
  * @see drupal_render()
  * @see _drupal_render_process_post_render_cache()
  */
-function drupal_render_collect_post_render_cache(array &$elements, array $callbacks = array(), $is_root_element = TRUE) {
+function drupal_render_collect_post_render_cache(&$elements, array $callbacks = array(), $is_root_element = TRUE) {
   // Try to fetch the prerendered element from cache, to determine
   // #post_render_cache callbacks for this element and all its children. If we
   // don't do this, then the #post_render_cache tokens will be re-generated, but
diff --git a/core/lib/Drupal/Core/Render/Element.php b/core/lib/Drupal/Core/Render/Element.php
index 501f2de..f4993c2 100644
--- a/core/lib/Drupal/Core/Render/Element.php
+++ b/core/lib/Drupal/Core/Render/Element.php
@@ -68,7 +68,7 @@ public static function child($key) {
    * @return array
    *   The array keys of the element's children.
    */
-  public static function children(array &$elements, $sort = FALSE) {
+  public static function children(&$elements, $sort = FALSE) {
     // Do not attempt to sort elements which have already been sorted.
     $sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;
 
@@ -77,7 +77,7 @@ public static function children(array &$elements, $sort = FALSE) {
     $sortable = FALSE;
     foreach ($elements as $key => $value) {
       if ($key === '' || $key[0] !== '#') {
-        if (is_array($value)) {
+        if (is_array($value) || is_object($value)) {
           $children[$key] = $value;
           if (isset($value['#weight'])) {
             $sortable = TRUE;
