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/form.inc b/core/includes/form.inc
index eee8be1..471db5a 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -682,8 +682,8 @@ 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);
+    // Remove $form_id and $form_state from the arguments.
+    unset($args[0], $args[1]);
     $form_state['build_info']['args'] = $args;
   }
   // Merge in default values.
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/openid/openid.pages.inc b/core/modules/openid/openid.pages.inc
index 885fe1d..5652af2 100644
--- a/core/modules/openid/openid.pages.inc
+++ b/core/modules/openid/openid.pages.inc
@@ -105,13 +105,14 @@ function openid_user_delete_form($form, $form_state, $account, $aid = 0) {
 }
 
 function openid_user_delete_form_submit($form, &$form_state) {
+  $args = array_values($form_state['build_info']['args']);
   $query = db_delete('authmap')
-    ->condition('uid', $form_state['build_info']['args'][0]->uid)
-    ->condition('aid', $form_state['build_info']['args'][1])
+    ->condition('uid', $args[0]->uid)
+    ->condition('aid', $args[1])
     ->condition('module', 'openid')
     ->execute();
   if ($query) {
     drupal_set_message(t('OpenID deleted.'));
   }
-  $form_state['redirect'] = 'user/' . $form_state['build_info']['args'][0]->uid . '/openid';
+  $form_state['redirect'] = 'user/' . $args[0]->uid . '/openid';
 }
