diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 60b086a..01e4825 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2541,7 +2541,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_container()->get('module_handler')->invokeAll($hook, $args);
 }
 
@@ -3488,7 +3488,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/includes/file.inc b/core/includes/file.inc
index c66a2e0..e887378 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1336,13 +1336,17 @@ function file_transfer($uri, $headers) {
  * If the file exists but no modules responded an AccessDeniedHttpException will
  * be thrown.If the file does not exist a NotFoundHttpException will be thrown.
  *
+ * @param string $scheme
+ *   A URI scheme, a stream is referenced as "scheme://target".
+ *
  * @see hook_file_download()
  * @see system_menu()
  */
-function file_download() {
+function file_download($scheme) {
   // Merge remaining path arguments into relative file path.
   $args = func_get_args();
-  $scheme = array_shift($args);
+  // Remove $scheme from the arguments.
+  unset($args[0]);
   $target = implode('/', $args);
   $uri = $scheme . '://' . $target;
   if (file_stream_wrapper_valid_scheme($scheme) && file_exists($uri)) {
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 513615c..cee4289 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -131,8 +131,8 @@ function drupal_get_form($form_id) {
 
   $args = func_get_args();
   // Remove $form_id from the arguments.
-  array_shift($args);
-  $form_state['build_info']['args'] = $args;
+  unset($args[0]);
+  $form_state['build_info']['args'] = array_values($args);
 
   return drupal_build_form($form_id, $form_state);
 }
@@ -684,9 +684,9 @@ function form_load_include(&$form_state, $type, $module, $name = NULL) {
 function drupal_form_submit($form_id, &$form_state) {
   if (!isset($form_state['build_info']['args'])) {
     $args = func_get_args();
-    array_shift($args);
-    array_shift($args);
-    $form_state['build_info']['args'] = $args;
+    // Remove $form_id and $form_state from the arguments.
+    unset($args[0], $args[1]);
+    $form_state['build_info']['args'] = array_values($args);
   }
   // Merge in default values.
   $form_state += form_state_defaults();
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index 87d0a37..780535c 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -37,7 +37,12 @@ function color_theme() {
  * Implements hook_form_FORM_ID_alter().
  */
 function color_form_system_theme_settings_alter(&$form, &$form_state) {
-  if (isset($form_state['build_info']['args'][0]) && ($theme = $form_state['build_info']['args'][0]) && color_get_info($theme) && function_exists('gd_info')) {
+  if (empty($form_state['build_info']['args'])) {
+    return;
+  }
+  $theme = reset($form_state['build_info']['args']);
+
+  if (color_get_info($theme) && function_exists('gd_info')) {
     $form['color'] = array(
       '#type' => 'details',
       '#title' => t('Color scheme'),
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 50f1081..bf20e46 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -593,8 +593,8 @@ function image_style_deliver($style, $scheme) {
   }
 
   $args = func_get_args();
-  array_shift($args);
-  array_shift($args);
+  // Remove $style and $scheme from the arguments.
+  unset($args[0], $args[1]);
   $target = implode('/', $args);
 
   $image_uri = $scheme . '://' . $target;
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 389d254..f947d1b 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -440,8 +440,7 @@ function views_arg_load($value, $name, $display_id, $index) {
 function views_page($name, $display_id) {
   $args = func_get_args();
   // Remove $name and $display_id from the arguments.
-  array_shift($args);
-  array_shift($args);
+  unset($args[0], $args[1]);
 
   // Load the view and render it.
   if ($view = views_get_view($name)) {
@@ -1736,10 +1735,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)) {
@@ -1768,10 +1765,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)) {
diff --git a/core/modules/views/views_ui/views_ui.module b/core/modules/views/views_ui/views_ui.module
index 5157195..a35d82e 100644
--- a/core/modules/views/views_ui/views_ui.module
+++ b/core/modules/views/views_ui/views_ui.module
@@ -586,8 +586,9 @@ function views_ui_ajax_get_form($form_id) {
   $form_state['rebuild_info']['copy']['#action'] = TRUE;
 
   // @see drupal_get_form()
+  // Remove $form_id from the arguments.
   $args = func_get_args();
-  array_shift($args);
+  unset($args[0]);
   $form_state['build_info']['args'] = $args;
   $form = drupal_build_form($form_id, $form_state);
 
