diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index d92e27c..fd24e01 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1899,7 +1899,7 @@ function module_invoke($module, $hook) {
 function module_invoke_all($hook) {
   $args = func_get_args();
   // Remove $hook from the arguments.
-  array_shift($args);
+  unset($args[0]);
   return \Drupal::moduleHandler()->invokeAll($hook, $args);
 }
 
@@ -2498,7 +2498,8 @@ function &drupal_register_shutdown_function($callback = NULL) {
       register_shutdown_function('_drupal_shutdown_function');
     }
     $args = func_get_args();
-    array_shift($args);
+    // Remove $callback from the arguments.
+    unset($args[0]);
     // Save callback and arguments
     $callbacks[] = array('callback' => $callback, 'arguments' => $args);
   }
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 9a19f55..8e8a82a 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -181,8 +181,8 @@ public function getForm($form_arg) {
 
     $args = func_get_args();
     // Remove $form_arg from the arguments.
-    array_shift($args);
-    $form_state['build_info']['args'] = $args;
+    unset($args[0]);
+    $form_state['build_info']['args'] = array_values($args);
 
     $form_id = $this->getFormId($form_arg, $form_state);
     return $this->buildForm($form_id, $form_state);
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 1959cd8..ac368d9 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -1070,10 +1070,8 @@ function _views_query_tag_alter_condition(AlterableInterface $query, &$condition
  */
 function views_embed_view($name, $display_id = 'default') {
   $args = func_get_args();
-  array_shift($args); // remove $name
-  if (count($args)) {
-    array_shift($args); // remove $display_id
-  }
+  // Remove $name and $display_id from the arguments.
+  unset($args[0], $args[1]);
 
   $view = views_get_view($name);
   if (!$view || !$view->access($display_id)) {
@@ -1102,10 +1100,8 @@ function views_embed_view($name, $display_id = 'default') {
  */
 function views_get_view_result($name, $display_id = NULL) {
   $args = func_get_args();
-  array_shift($args); // remove $name
-  if (count($args)) {
-    array_shift($args); // remove $display_id
-  }
+  // Remove $name and $display_id from the arguments.
+  unset($args[0], $args[1]);
 
   $view = views_get_view($name);
   if (is_object($view)) {
