diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index d37a98e..1a1732f 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2946,6 +2946,7 @@ function &drupal_register_shutdown_function($callback = NULL) {
       register_shutdown_function('_drupal_shutdown_function');
     }
     $args = func_get_args();
+    // Remove $callback from the arguments.
     array_shift($args);
     // 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/includes/module.inc b/includes/module.inc
index 66c77f5..351eec4 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -789,7 +789,8 @@ function module_implements_write_cache() {
 function module_invoke($module, $hook) {
   $args = func_get_args();
   // Remove $module and $hook from the arguments.
-  unset($args[0], $args[1]);
+  array_shift($args);
+  array_shift($args);
   if (module_hook($module, $hook)) {
     return call_user_func_array($module . '_' . $hook, $args);
   }
@@ -810,7 +811,7 @@ function module_invoke($module, $hook) {
 function module_invoke_all($hook) {
   $args = func_get_args();
   // Remove $hook from the arguments.
-  unset($args[0]);
+  array_shift($args);
   $return = array();
   foreach (module_implements($hook) as $module) {
     $function = $module . '_' . $hook;
