diff --git a/core/includes/form.inc b/core/includes/form.inc
index c037ce1..b0c2f95 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -2941,7 +2941,12 @@ function template_preprocess_form_element(&$variables) {
   // Add label_display and label variables to template.
   $variables['label_display'] = $element['#title_display'];
   $variables['label'] = array('#theme' => 'form_element_label');
-  $variables['label'] += array_intersect_key($element, array_flip(array('#id', '#required', '#title', '#title_display')));
+  $variables['label'] += array_intersect_key($element, array(
+    '#id' => 1,
+    '#required' => 1,
+    '#title' => 1,
+    '#title_display' => 1,
+  ));
 
   $variables['children'] = $element['#children'];
 }
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 12c11e6..e9def84 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -530,11 +530,13 @@ function _theme($hook, $variables = array()) {
   // function may call _theme('node', ...), but a module can add
   // 'node__article' as a suggestion via hook_theme_suggestions_HOOK_alter(),
   // enabling a theme to have an alternate template file for article nodes.
-  foreach (array_reverse($suggestions) as $suggestion) {
+  end($suggestions);
+  while ($suggestion = current($suggestions)) {
     if ($theme_registry->has($suggestion)) {
       $info = $theme_registry->get($suggestion);
       break;
     }
+    prev($suggestions);
   }
 
   // Include a file if the theme function or variable preprocessor is held
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 3efa1f2..c11ee25 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -1015,8 +1015,8 @@ 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']) {
-      foreach ($element['#process'] as $process) {
-        $element = call_user_func_array($process, array(&$element, &$form_state, &$form_state['complete_form']));
+      foreach ($element['#process'] as $callable) {
+        $element = $callable($element, $form_state, $form_state['complete_form']);
       }
       $element['#processed'] = TRUE;
     }
@@ -1080,7 +1080,7 @@ public function doBuildForm($form_id, &$element, &$form_state) {
     // after normal input parsing has been completed.
     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 = $callable($element, $form_state);
       }
       $element['#after_build_done'] = TRUE;
     }
@@ -1224,7 +1224,7 @@ protected function handleInputElement($form_id, &$element, &$form_state) {
         // property, optionally filtered through $value_callback.
         if ($input_exists) {
           if (is_callable($value_callable)) {
-            $element['#value'] = call_user_func_array($value_callable, array(&$element, $input, &$form_state));
+            $element['#value'] = $value_callable($element, $input, $form_state);
           }
           if (!isset($element['#value']) && isset($input)) {
             $element['#value'] = $input;
@@ -1240,7 +1240,7 @@ protected function handleInputElement($form_id, &$element, &$form_state) {
         // Call #type_value without a second argument to request default_value
         // handling.
         if (is_callable($value_callable)) {
-          $element['#value'] = call_user_func_array($value_callable, array(&$element, FALSE, &$form_state));
+          $element['#value'] = $value_callable($element, FALSE, $form_state);
         }
         // Final catch. If we haven't set a value yet, use the explicit default
         // value. Avoid image buttons (which come with garbage value), so we
diff --git a/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php
index dbd44e9..fdddccd 100644
--- a/core/lib/Drupal/Core/Utility/ThemeRegistry.php
+++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php
@@ -102,7 +102,7 @@ public function has($key) {
     // are not registered, just check the existence of the key in the registry.
     // Use array_key_exists() here since a NULL value indicates that the theme
     // hook exists but has not yet been requested.
-    return array_key_exists($key, $this->storage);
+    return isset($this->storage[$key]) || array_key_exists($key, $this->storage);
   }
 
   /**
