diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index c2d06c4..1346326 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -3457,7 +3457,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 133d64f..4cae398 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1947,13 +1947,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 eee8be1..efbbd8e 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -128,8 +128,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();
@@ -3821,8 +3821,7 @@ function theme_vertical_tabs($variables) {
  *   $args = func_get_args();
  *   // We need to remove $arg1 and $arg2 from the beginning of the array so we
  *   // are left with the keywords.
- *   array_shift($args);
- *   array_shift($args);
+ *   unset($args[0], $args[1]);
  *   // We store the user's original input in $keywords, including any slashes.
  *   $keywords = implode('/', $args);
  *
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index b2b67a7..3efe980 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' => 'fieldset',
       '#title' => t('Color scheme'),
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index aa05d04..e9bf8c6 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -722,8 +722,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/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index 879d685..1688704 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -111,8 +111,8 @@ function taxonomy_autocomplete($field_name, $tags_typed = '') {
   // If the request has a '/' in the search text, then the menu system will have
   // split it into multiple arguments, recover the intended $tags_typed.
   $args = func_get_args();
-  // Shift off the $field_name argument.
-  array_shift($args);
+  // Remove $field_name from the arguments.
+  unset($args[0]);
   $tags_typed = implode('/', $args);
 
   // Make sure the field exists and is a taxonomy field.
