diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 49f0a31..c027651 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -3342,7 +3342,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 bcd3033..d5a126e 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1341,13 +1341,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 f5f5b98..cf5572c 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -129,8 +129,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);
 }
@@ -682,9 +682,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 53a7f39..b862336 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 221e07c..5cc44b6 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -657,8 +657,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 7223e53..05e47a0 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -556,8 +556,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)) {
@@ -2034,10 +2033,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)) {
@@ -2066,10 +2063,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 74c9e07..37b5c84 100644
--- a/core/modules/views/views_ui/views_ui.module
+++ b/core/modules/views/views_ui/views_ui.module
@@ -597,8 +597,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);
 
