diff --git a/includes/common.inc b/includes/common.inc
index c6638dc..ee6562d 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -6140,9 +6140,14 @@ function element_children(&$elements, $sort = FALSE) {
   $sortable = FALSE;
   foreach ($elements as $key => $value) {
     if ($key === '' || $key[0] !== '#') {
-      $children[$key] = $value;
-      if (is_array($value) && isset($value['#weight'])) {
-        $sortable = TRUE;
+      if (is_array($value)) {
+        $children[$key] = $value;
+        if (isset($value['#weight'])) {
+          $sortable = TRUE;
+        }
+      }
+      else {
+        trigger_error(t('"@key" is an invalid render array key', array('@key' => $key)), E_USER_ERROR);
       }
     }
   }
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 177e457..a278edb 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -1708,6 +1708,23 @@ class DrupalRenderTestCase extends DrupalWebTestCase {
     ));
   }
 
+  /**
+   * Test rendering elements with invalid keys.
+   */
+  function testDrupalRenderInvalidKeys() {
+    $error = array(
+      '%type' => 'User error',
+      '!message' => '"child" is an invalid render array key',
+      '%function' => 'element_children()',
+    );
+    $message = t('%type: !message in %function (line ', $error);
+
+    variable_set('error_level', ERROR_REPORTING_DISPLAY_ALL);
+    $this->drupalGet('common-test/drupal-render-invalid-keys');
+    $this->assertResponse(200, t('Received expected HTTP status code.'));
+    $this->assertRaw($message, t('Found error message: !message.', array('!message' => $message)));
+  }
+
   protected function assertRenderedElement(array $element, $xpath, array $xpath_args = array()) {
     $original_element = $element;
     $this->drupalSetContent(drupal_render($element));
diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module
index c400eae..694f426 100644
--- a/modules/simpletest/tests/common_test.module
+++ b/modules/simpletest/tests/common_test.module
@@ -52,6 +52,12 @@ function common_test_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['common-test/drupal-render-invalid-keys'] = array(
+    'title' => 'Drupal Render',
+    'page callback' => 'common_test_drupal_render_invalid_keys',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -101,6 +107,22 @@ function common_test_destination() {
 }
 
 /**
+ * Render an element with an invalid render array key.
+ */
+function common_test_drupal_render_invalid_keys() {
+  define('SIMPLETEST_COLLECT_ERRORS', FALSE);
+
+  // Keys that begin with # may contain a value of any type, otherwise they must
+  // contain arrays.
+  $key = 'child';
+  $value = 'This should be an array.';
+  $element = array(
+    $key => $value,
+  );
+  return drupal_render($element);
+}
+
+/**
  * Implements hook_TYPE_alter().
  */
 function common_test_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
