diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index d37a98e..c5c748b 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2946,7 +2946,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/includes/form.inc b/includes/form.inc
index 10e68ee..e8967d9 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -656,6 +656,7 @@ 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();
+    // Remove $form_id and $form_state from the arguments.
     array_shift($args);
     array_shift($args);
     $form_state['build_info']['args'] = $args;
diff --git a/modules/image/image.module b/modules/image/image.module
index 008a365..88a0a3c 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -702,8 +702,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;
