diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 15729e89fe..46baf3cff5 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -3776,7 +3776,7 @@ function _drupal_shutdown_function() { chdir(DRUPAL_ROOT); try { - foreach ($callbacks as $key => $callback) { + foreach ($callbacks as $callback) { call_user_func_array($callback['callback'], $callback['arguments']); } } diff --git a/includes/install.inc b/includes/install.inc index 08518fed08..b7db783586 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -779,7 +779,7 @@ function drupal_uninstall_modules($module_list = array(), $uninstall_dependents $module_list = array_flip(array_values($module_list)); $profile = drupal_get_profile(); - foreach ($module_list as $module => $weight) { + foreach (array_keys($module_list) as $module) { if (!isset($module_data[$module]) || drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) { // This module doesn't exist or is already uninstalled. Skip it. unset($module_list[$module]); diff --git a/includes/menu.inc b/includes/menu.inc index d32c6ac6d4..9bee2216c7 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2403,7 +2403,6 @@ function menu_set_active_trail($new_trail = NULL) { // a stripped down menu tree containing the active trail only, in case // the given menu has not been built in this request yet. $tree = menu_tree_page_data($preferred_link['menu_name'], NULL, TRUE); - $key = key($tree); $curr = current($tree); } // There is no link for the current path. @@ -2434,7 +2433,6 @@ function menu_set_active_trail($new_trail = NULL) { } $tree = $curr['below'] ? $curr['below'] : array(); } - $key = key($tree); $curr = current($tree); next($tree); } diff --git a/includes/module.inc b/includes/module.inc index 54205f5348..f8e229dd78 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -404,7 +404,7 @@ function module_enable($module_list, $enable_dependencies = TRUE) { // Create an associative array with weights as values. $module_list = array_flip(array_values($module_list)); - foreach ($module_list as $module => $weight) { + while ($module = key($module_list)) { if (!isset($module_data[$module])) { // This module is not found in the filesystem, abort. return FALSE; @@ -423,6 +423,8 @@ function module_enable($module_list, $enable_dependencies = TRUE) { $module_list[$dependency] = 0; } } + + next($module_list); } if (!$module_list) { @@ -540,7 +542,7 @@ function module_disable($module_list, $disable_dependents = TRUE) { $module_list = array_flip(array_values($module_list)); $profile = drupal_get_profile(); - foreach ($module_list as $module => $weight) { + while ($module = key($module_list)) { if (!isset($module_data[$module]) || !$module_data[$module]->status) { // This module doesn't exist or is already disabled, skip it. unset($module_list[$module]); @@ -555,6 +557,8 @@ function module_disable($module_list, $disable_dependents = TRUE) { $module_list[$dependent] = 0; } } + + next($module_list); } // Sort the module list by pre-calculated weights.