diff --git a/core/includes/common.inc b/core/includes/common.inc
index 8f60fe4..67f2649 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3741,7 +3741,7 @@ function drupal_render_page($page) {
  *   - The child elements of this element are sorted by weight using uasort() in
  *     element_children(). Since this is expensive, when passing already sorted
  *     elements to drupal_render(), for example from a database query, set
- *     $elements['#sorted'] = TRUE to avoid sorting them a second time.
+ *     $elements['#_sorted'] = TRUE to avoid sorting them a second time.
  *   - The main render phase to produce #children for this element takes place:
  *     - If this element has #theme defined and #theme is an implemented theme
  *       hook/suggestion then theme() is called and must render both the element
@@ -4541,7 +4541,7 @@ function element_child($key) {
  */
 function element_children(&$elements, $sort = FALSE) {
   // Do not attempt to sort elements which have already been sorted.
-  $sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;
+  $sort = isset($elements['#_sorted']) ? !$elements['#_sorted'] : $sort;
 
   // Filter out properties from the element, leaving only children.
   $children = array();
@@ -4571,7 +4571,7 @@ function element_children(&$elements, $sort = FALSE) {
       unset($elements[$key]);
       $elements[$key] = $child;
     }
-    $elements['#sorted'] = TRUE;
+    $elements['#_sorted'] = TRUE;
   }
 
   return array_keys($children);
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 5867a36..55b4b5d 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -559,7 +559,7 @@ function form_type_radios_value(&$element, $input = FALSE) {
     // unless it's empty. (An empty #default_value, such as NULL or FALSE, can
     // be used to indicate that no radio button is selected by default.)
     if (!isset($input) && !empty($element['#default_value'])) {
-      $element['#needs_validation'] = TRUE;
+      $element['#_needs_validation'] = TRUE;
     }
     return $input;
   }
@@ -2039,7 +2039,7 @@ function form_pre_render_group($element) {
     }
     // Re-sort the element's children if we injected group member elements.
     if (isset($sort)) {
-      $element['#sorted'] = FALSE;
+      $element['#_sorted'] = FALSE;
     }
   }
 
@@ -2662,7 +2662,7 @@ function form_pre_render_password($element) {
  * Expands a weight element into a select element.
  */
 function form_process_weight($element) {
-  $element['#is_weight'] = TRUE;
+  $element['#_is_weight'] = TRUE;
 
   // If the number of options is small enough, use a select field.
   $max_elements = \Drupal::config('system.site')->get('weight_select_max');
@@ -2931,7 +2931,7 @@ function _form_set_attributes(&$element, $class = array()) {
     $element['#attributes']['required'] = 'required';
     $element['#attributes']['aria-required'] = 'true';
   }
-  if (isset($element['#parents']) && form_get_error($element) !== NULL && !empty($element['#validated'])) {
+  if (isset($element['#parents']) && form_get_error($element) !== NULL && !empty($element['#_validated'])) {
     $element['#attributes']['class'][] = 'error';
     $element['#attributes']['aria-invalid'] = 'true';
   }
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index a8a30b6..2dbe405 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1154,7 +1154,7 @@ function menu_tree_output($tree) {
   }
   if ($build) {
     // Make sure drupal_render() does not re-order the links.
-    $build['#sorted'] = TRUE;
+    $build['#_sorted'] = TRUE;
     // Add the theme wrapper for outer markup.
     // Allow menu-specific theme overrides.
     $build['#theme_wrappers'][] = 'menu_tree__' . strtr($data['link']['menu_name'], '-', '_');
diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
index 2680e6f..55a3f73 100644
--- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
+++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
@@ -230,7 +230,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
     }
 
     $view_hook = "{$this->entityType}_view";
-    $build = array('#sorted' => TRUE);
+    $build = array('#_sorted' => TRUE);
     $weight = 0;
     foreach ($entities as $key => $entity) {
       $entity_view_mode = isset($entity->content['#view_mode']) ? $entity->content['#view_mode'] : $view_mode;
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index cbaf908..45a0824 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -326,11 +326,11 @@ public function rebuildForm($form_id, &$form_state, $old_form = NULL) {
     // build's data in the form cache; also allowing the user to go back to an
     // earlier build, make changes, and re-submit.
     // @see self::prepareForm()
-    if (isset($old_form['#build_id']) && !empty($form_state['rebuild_info']['copy']['#build_id'])) {
-      $form['#build_id'] = $old_form['#build_id'];
+    if (isset($old_form['#_build_id']) && !empty($form_state['rebuild_info']['copy']['#_build_id'])) {
+      $form['#_build_id'] = $old_form['#_build_id'];
     }
     else {
-      $form['#build_id'] = 'form-' . Crypt::hashBase64(uniqid(mt_rand(), TRUE) . mt_rand());
+      $form['#_build_id'] = 'form-' . Crypt::hashBase64(uniqid(mt_rand(), TRUE) . mt_rand());
     }
 
     // #action defaults to request_uri(), but in case of Ajax and other partial
@@ -347,7 +347,7 @@ public function rebuildForm($form_id, &$form_state, $old_form = NULL) {
     // self::doBuildForm(), so we need to do it here.
     // @todo For Drupal 8, find a way to avoid this code duplication.
     if (empty($form_state['no_cache'])) {
-      $this->setCache($form['#build_id'], $form, $form_state);
+      $this->setCache($form['#_build_id'], $form, $form_state);
     }
 
     // Clear out all group associations as these might be different when
@@ -590,13 +590,13 @@ public function processForm($form_id, &$form, &$form_state) {
     // With $_GET, these forms are always submitted if requested.
     if ($form_state['method'] == 'get' && !empty($form_state['always_process'])) {
       if (!isset($form_state['input']['form_build_id'])) {
-        $form_state['input']['form_build_id'] = $form['#build_id'];
+        $form_state['input']['form_build_id'] = $form['#_build_id'];
       }
       if (!isset($form_state['input']['form_id'])) {
         $form_state['input']['form_id'] = $form_id;
       }
-      if (!isset($form_state['input']['form_token']) && isset($form['#token'])) {
-        $form_state['input']['form_token'] = $this->csrfToken->get($form['#token']);
+      if (!isset($form_state['input']['form_token']) && isset($form['#_token'])) {
+        $form_state['input']['form_token'] = $this->csrfToken->get($form['#_token']);
       }
     }
 
@@ -703,7 +703,7 @@ public function processForm($form_id, &$form, &$form_state) {
     // request to accommodate new user input. Rebuilt forms are not cached here,
     // because self::rebuildForm() already takes care of that.
     if (!$form_state['rebuild'] && $form_state['cache'] && empty($form_state['no_cache'])) {
-      $this->setCache($form['#build_id'], $unprocessed_form, $form_state);
+      $this->setCache($form['#_build_id'], $unprocessed_form, $form_state);
     }
   }
 
@@ -727,13 +727,13 @@ public function prepareForm($form_id, &$form, &$form_state) {
     // build, make changes, and re-submit.
     // @see self::buildForm()
     // @see self::rebuildForm()
-    if (!isset($form['#build_id'])) {
-      $form['#build_id'] = 'form-' . Crypt::hashBase64(uniqid(mt_rand(), TRUE) . mt_rand());
+    if (!isset($form['#_build_id'])) {
+      $form['#_build_id'] = 'form-' . Crypt::hashBase64(uniqid(mt_rand(), TRUE) . mt_rand());
     }
     $form['form_build_id'] = array(
       '#type' => 'hidden',
-      '#value' => $form['#build_id'],
-      '#id' => $form['#build_id'],
+      '#value' => $form['#_build_id'],
+      '#id' => $form['#_build_id'],
       '#name' => 'form_build_id',
       // Form processing and validation requires this value, so ensure the
       // submitted form value appears literally, regardless of custom #tree
@@ -752,16 +752,16 @@ public function prepareForm($form_id, &$form, &$form_state) {
     if ($user && $user->isAuthenticated() && !$form_state['programmed']) {
       // Form constructors may explicitly set #token to FALSE when cross site
       // request forgery is irrelevant to the form, such as search forms.
-      if (isset($form['#token']) && $form['#token'] === FALSE) {
-        unset($form['#token']);
+      if (isset($form['#_token']) && $form['#_token'] === FALSE) {
+        unset($form['#_token']);
       }
       // Otherwise, generate a public token based on the form id.
       else {
-        $form['#token'] = $form_id;
+        $form['#_token'] = $form_id;
         $form['form_token'] = array(
           '#id' => $this->drupalHtmlId('edit-' . $form_id . '-form-token'),
           '#type' => 'token',
-          '#default_value' => $this->csrfToken->get($form['#token']),
+          '#default_value' => $this->csrfToken->get($form['#_token']),
           // Form processing and validation requires this value, so ensure the
           // submitted form value appears literally, regardless of custom #tree
           // and #parents being set elsewhere.
@@ -853,8 +853,8 @@ public function validateForm($form_id, &$form, &$form_state) {
 
     // If the session token was set by self::prepareForm(), ensure that it
     // matches the current user's session.
-    if (isset($form['#token'])) {
-      if (!$this->csrfToken->validate($form_state['values']['form_token'], $form['#token'])) {
+    if (isset($form['#_token'])) {
+      if (!$this->csrfToken->validate($form_state['values']['form_token'], $form['#_token'])) {
         $path = $this->request->attributes->get('_system_path');
         $query = Url::filterQueryParameters($this->request->query->all());
         $url = $this->urlGenerator->generateFromPath($path, array('query' => $query));
@@ -1013,9 +1013,9 @@ protected function doValidateForm(&$elements, &$form_state, $form_id = NULL) {
     }
 
     // Validate the current input.
-    if (!isset($elements['#validated']) || !$elements['#validated']) {
+    if (!isset($elements['#_validated']) || !$elements['#_validated']) {
       // The following errors are always shown.
-      if (isset($elements['#needs_validation'])) {
+      if (isset($elements['#_needs_validation'])) {
         // Verify that the value is not longer than #maxlength.
         if (isset($elements['#maxlength']) && Unicode::strlen($elements['#value']) > $elements['#maxlength']) {
           $this->setError($elements, $this->t('!name cannot be longer than %max characters but is currently %length characters long.', array('!name' => empty($elements['#title']) ? $elements['#parents'][0] : $elements['#title'], '%max' => $elements['#maxlength'], '%length' => Unicode::strlen($elements['#value']))));
@@ -1092,7 +1092,7 @@ protected function doValidateForm(&$elements, &$form_state, $form_id = NULL) {
       }
 
       // Make sure a value is passed when the field is required.
-      if (isset($elements['#needs_validation']) && $elements['#required']) {
+      if (isset($elements['#_needs_validation']) && $elements['#required']) {
         // A simple call to empty() will not cut it here as some fields, like
         // checkboxes, can return a valid value of '0'. Instead, check the
         // length if it's a string, and the item count if it's an array.
@@ -1142,7 +1142,7 @@ protected function doValidateForm(&$elements, &$form_state, $form_id = NULL) {
         }
       }
 
-      $elements['#validated'] = TRUE;
+      $elements['#_validated'] = TRUE;
     }
 
     // Done validating this element, so turn off error suppression.
@@ -1272,7 +1272,7 @@ public function setError(&$element, $message = '') {
    */
   public function doBuildForm($form_id, &$element, &$form_state) {
     // Initialize as unprocessed.
-    $element['#processed'] = FALSE;
+    $element['#_processed'] = FALSE;
 
     // Use element defaults.
     if (isset($element['#type']) && empty($element['#defaults_loaded']) && ($info = $this->getElementInfo($element['#type']))) {
@@ -1331,15 +1331,15 @@ public function doBuildForm($form_id, &$element, &$form_state) {
     }
     // Allow for elements to expand to multiple elements, e.g., radios,
     // checkboxes and files.
-    if (isset($element['#process']) && !$element['#processed']) {
+    if (isset($element['#process']) && !$element['#_processed']) {
       foreach ($element['#process'] as $process) {
         $element = call_user_func_array($process, array(&$element, &$form_state, &$form_state['complete_form']));
       }
-      $element['#processed'] = TRUE;
+      $element['#_processed'] = TRUE;
     }
 
     // We start off assuming all form elements are in the correct order.
-    $element['#sorted'] = TRUE;
+    $element['#_sorted'] = TRUE;
 
     // Recurse through all child elements.
     $count = 0;
@@ -1387,7 +1387,7 @@ public function doBuildForm($form_id, &$element, &$form_state) {
       else {
         // If one of the child elements has a weight then we will need to sort
         // later.
-        unset($element['#sorted']);
+        unset($element['#_sorted']);
       }
       $element[$key] = $this->doBuildForm($form_id, $element[$key], $form_state);
       $count++;
@@ -1395,11 +1395,11 @@ public function doBuildForm($form_id, &$element, &$form_state) {
 
     // The #after_build flag allows any piece of a form to be altered
     // after normal input parsing has been completed.
-    if (isset($element['#after_build']) && !isset($element['#after_build_done'])) {
+    if (isset($element['#after_build']) && !isset($element['#_after_build_done'])) {
       foreach ($element['#after_build'] as $callable) {
         $element = call_user_func_array($callable, array($element, &$form_state));
       }
-      $element['#after_build_done'] = TRUE;
+      $element['#_after_build_done'] = TRUE;
     }
 
     // If there is a file element, we need to flip a flag so later the
@@ -1437,7 +1437,7 @@ public function doBuildForm($form_id, &$element, &$form_state) {
 
       // If the triggering element executes submit handlers, then set the form
       // state key that's needed for those handlers to run.
-      if (!empty($form_state['triggering_element']['#executes_submit_callback'])) {
+      if (!empty($form_state['triggering_element']['#_executes_submit_callback'])) {
         $form_state['submitted'] = TRUE;
       }
 
@@ -1548,7 +1548,7 @@ protected function handleInputElement($form_id, &$element, &$form_state) {
         }
         // Mark all posted values for validation.
         if (isset($element['#value']) || (!empty($element['#required']))) {
-          $element['#needs_validation'] = TRUE;
+          $element['#_needs_validation'] = TRUE;
         }
       }
       // Load defaults.
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
index 932aba1..1ea92ec 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
@@ -272,7 +272,7 @@ public function categories() {
     $build = array(
       '#type' => 'container',
       '#attributes' => array('class' => array('aggregator-wrapper')),
-      '#sorted' => TRUE,
+      '#_sorted' => TRUE,
     );
     $aggregator_summary_items = $this->config('aggregator.settings')->get('source.list_max');
     foreach ($result as $category) {
@@ -320,7 +320,7 @@ public function sources() {
     $build = array(
       '#type' => 'container',
       '#attributes' => array('class' => array('aggregator-wrapper')),
-      '#sorted' => TRUE,
+      '#_sorted' => TRUE,
     );
 
     foreach ($feeds as $feed) {
diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
index f5228d0..3cf90d8 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
@@ -431,7 +431,7 @@ public function buildOptionsForm(&$form, &$form_state) {
         'path' => views_ui_build_form_path($form_state),
       ),
       '#submit' => array(array($this, 'submitTemporaryForm')),
-      '#executes_submit_callback' => TRUE,
+      '#_executes_submit_callback' => TRUE,
     );
 
     $form['field_api_classes'] = array(
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index 1041606..4d045b2 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -698,7 +698,7 @@ function filter_process_format($element) {
     '#prefix',
     '#suffix',
     '#attached',
-    '#processed',
+    '#_processed',
     '#theme_wrappers',
   );
   // Move this element into sub-element 'value'.
diff --git a/core/modules/system/lib/Drupal/system/Controller/FormAjaxController.php b/core/modules/system/lib/Drupal/system/Controller/FormAjaxController.php
index f1645a7..978f91f 100644
--- a/core/modules/system/lib/Drupal/system/Controller/FormAjaxController.php
+++ b/core/modules/system/lib/Drupal/system/Controller/FormAjaxController.php
@@ -91,7 +91,7 @@ protected function getForm(Request $request) {
     // When a form is rebuilt after Ajax processing, its #build_id and #action
     // should not change.
     // @see drupal_rebuild_form()
-    $form_state['rebuild_info']['copy']['#build_id'] = TRUE;
+    $form_state['rebuild_info']['copy']['#_build_id'] = TRUE;
     $form_state['rebuild_info']['copy']['#action'] = TRUE;
 
     // The form needs to be processed; prepare for that by setting a few internal
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
index 310a46d..3b8bbd1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
@@ -293,8 +293,8 @@ function testDrupalRenderSorting() {
     // The lowest weight element should appear last in $output.
     $this->assertTrue(strpos($output, $second) > strpos($output, $first), 'Elements were sorted correctly by weight.');
 
-    // Confirm that the $elements array has '#sorted' set to TRUE.
-    $this->assertTrue($elements['#sorted'], "'#sorted' => TRUE was added to the array");
+    // Confirm that the $elements array has '#_sorted' set to TRUE.
+    $this->assertTrue($elements['#_sorted'], "'#_sorted' => TRUE was added to the array");
 
     // Pass $elements through element_children() and ensure it remains
     // sorted in the correct order. drupal_render() will return an empty string
@@ -314,7 +314,7 @@ function testDrupalRenderSorting() {
         '#weight' => 0,
         '#markup' => $first,
       ),
-      '#sorted' => TRUE,
+      '#_sorted' => TRUE,
     );
     $output = drupal_render($elements);
 
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 29237fd..31e0845 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -139,7 +139,7 @@ function system_themes_page() {
   drupal_alter('system_themes_page', $theme_groups);
 
   $build = array(
-    '#sorted' => TRUE,
+    '#_sorted' => TRUE,
   );
   $build['system_themes_page'] = array(
     '#theme' => 'system_themes_page',
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 71f2860..4f03d4e 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -291,7 +291,7 @@ function system_element_info() {
     '#input' => TRUE,
     '#name' => 'op',
     '#is_button' => TRUE,
-    '#executes_submit_callback' => TRUE,
+    '#_executes_submit_callback' => TRUE,
     '#limit_validation_errors' => FALSE,
     '#process' => array('form_process_button', 'ajax_process_form'),
     '#pre_render' => array('form_pre_render_button'),
@@ -301,7 +301,7 @@ function system_element_info() {
     '#input' => TRUE,
     '#name' => 'op',
     '#is_button' => TRUE,
-    '#executes_submit_callback' => FALSE,
+    '#_executes_submit_callback' => FALSE,
     '#limit_validation_errors' => FALSE,
     '#process' => array('form_process_button', 'ajax_process_form'),
     '#pre_render' => array('form_pre_render_button'),
@@ -310,7 +310,7 @@ function system_element_info() {
   $types['image_button'] = array(
     '#input' => TRUE,
     '#is_button' => TRUE,
-    '#executes_submit_callback' => TRUE,
+    '#_executes_submit_callback' => TRUE,
     '#limit_validation_errors' => FALSE,
     '#process' => array('form_process_button', 'ajax_process_form'),
     '#return_value' => TRUE,
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index eeef432..41850be 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -154,7 +154,7 @@ function tracker_page($account = NULL, $set_title = FALSE) {
     '#quantity' => 25,
     '#weight' => 10,
   );
-  $page['#sorted'] = TRUE;
+  $page['#_sorted'] = TRUE;
 
   return $page;
 }
diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
index b0779bd..0ea1f8f 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@@ -427,19 +427,19 @@ public function testRebuildForm() {
     $form_state['build_info']['callback_object'] = $form_arg;
     $form_state['build_info']['args'] = array();
     $form = $this->formBuilder->buildForm($form_id, $form_state);
-    $original_build_id = $form['#build_id'];
+    $original_build_id = $form['#_build_id'];
 
     // Rebuild the form, and assert that the build ID has not changed.
     $form_state['rebuild'] = TRUE;
     $form_state['input']['form_id'] = $form_id;
-    $form_state['rebuild_info']['copy']['#build_id'] = TRUE;
+    $form_state['rebuild_info']['copy']['#_build_id'] = TRUE;
     $this->formBuilder->processForm($form_id, $form, $form_state);
-    $this->assertSame($original_build_id, $form['#build_id']);
+    $this->assertSame($original_build_id, $form['#_build_id']);
 
     // Rebuild the form again, and assert that there is a new build ID.
     $form_state['rebuild_info'] = array();
     $form = $this->formBuilder->buildForm($form_id, $form_state);
-    $this->assertNotSame($original_build_id, $form['#build_id']);
+    $this->assertNotSame($original_build_id, $form['#_build_id']);
   }
 
   /**
@@ -510,10 +510,10 @@ public function testGetCache() {
 
     // Rebuild the form, this time setting it up to be cached.
     $form_state['rebuild'] = TRUE;
-    $form_state['rebuild_info']['copy']['#build_id'] = TRUE;
-    $form_state['input']['form_token'] = $form['#token'];
+    $form_state['rebuild_info']['copy']['#_build_id'] = TRUE;
+    $form_state['input']['form_token'] = $form['#_token'];
     $form_state['input']['form_id'] = $form_id;
-    $form_state['input']['form_build_id'] = $form['#build_id'];
+    $form_state['input']['form_build_id'] = $form['#_build_id'];
     $form = $this->formBuilder->buildForm($form_id, $form_state);
 
     $cached_form = $form;
