Issue #2925449 by bkosborne, oriol_e9g, Ayesh, sjerdo, mikeytown2, piggito, vprocessor, JayKandari, delta, joseph.olstad, andypost, Fabianx, David_Rothstein, Neo13, yogeshmpawar, amme: [PHP 7] Function each() is deprecated since PHP 7.2 [D7]
parent
127ffe91ff
commit
28de677281
|
@ -8,7 +8,8 @@ Drupal 7.xx, xxxx-xx-xx (development version)
|
||||||
- Allowed callers of drupal_http_request() to optionally specify an explicit
|
- Allowed callers of drupal_http_request() to optionally specify an explicit
|
||||||
Host header.
|
Host header.
|
||||||
- Allowed the + character to appear in usernames.
|
- Allowed the + character to appear in usernames.
|
||||||
- Fixed Archive_Tar incompatibility with PHP 7.2.
|
- PHP 7.2: Fixed Archive_Tar incompatibility
|
||||||
|
- PHP 7.2: Removed deprecated function each()
|
||||||
|
|
||||||
Drupal 7.59, 2018-04-25
|
Drupal 7.59, 2018-04-25
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
|
@ -3785,8 +3785,12 @@ function _drupal_shutdown_function() {
|
||||||
chdir(DRUPAL_ROOT);
|
chdir(DRUPAL_ROOT);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (list($key, $callback) = each($callbacks)) {
|
// Manually iterate over the array instead of using a foreach loop.
|
||||||
|
// A foreach operates on a copy of the array, so any shutdown functions that
|
||||||
|
// were added from other shutdown functions would never be called.
|
||||||
|
while ($callback = current($callbacks)) {
|
||||||
call_user_func_array($callback['callback'], $callback['arguments']);
|
call_user_func_array($callback['callback'], $callback['arguments']);
|
||||||
|
next($callbacks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $exception) {
|
catch (Exception $exception) {
|
||||||
|
|
|
@ -779,7 +779,7 @@ function drupal_uninstall_modules($module_list = array(), $uninstall_dependents
|
||||||
$module_list = array_flip(array_values($module_list));
|
$module_list = array_flip(array_values($module_list));
|
||||||
|
|
||||||
$profile = drupal_get_profile();
|
$profile = drupal_get_profile();
|
||||||
while (list($module) = each($module_list)) {
|
foreach (array_keys($module_list) as $module) {
|
||||||
if (!isset($module_data[$module]) || drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
|
if (!isset($module_data[$module]) || drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
|
||||||
// This module doesn't exist or is already uninstalled. Skip it.
|
// This module doesn't exist or is already uninstalled. Skip it.
|
||||||
unset($module_list[$module]);
|
unset($module_list[$module]);
|
||||||
|
|
|
@ -576,7 +576,8 @@ function _menu_load_objects(&$item, &$map) {
|
||||||
// 'load arguments' in the hook_menu() entry, but they need
|
// 'load arguments' in the hook_menu() entry, but they need
|
||||||
// some processing. In this case the $function is the key to the
|
// some processing. In this case the $function is the key to the
|
||||||
// load_function array, and the value is the list of arguments.
|
// load_function array, and the value is the list of arguments.
|
||||||
list($function, $args) = each($function);
|
$args = current($function);
|
||||||
|
$function = key($function);
|
||||||
$load_functions[$index] = $function;
|
$load_functions[$index] = $function;
|
||||||
|
|
||||||
// Some arguments are placeholders for dynamic items to process.
|
// Some arguments are placeholders for dynamic items to process.
|
||||||
|
@ -2402,7 +2403,8 @@ function menu_set_active_trail($new_trail = NULL) {
|
||||||
// a stripped down menu tree containing the active trail only, in case
|
// a stripped down menu tree containing the active trail only, in case
|
||||||
// the given menu has not been built in this request yet.
|
// the given menu has not been built in this request yet.
|
||||||
$tree = menu_tree_page_data($preferred_link['menu_name'], NULL, TRUE);
|
$tree = menu_tree_page_data($preferred_link['menu_name'], NULL, TRUE);
|
||||||
list($key, $curr) = each($tree);
|
$curr = current($tree);
|
||||||
|
next($tree);
|
||||||
}
|
}
|
||||||
// There is no link for the current path.
|
// There is no link for the current path.
|
||||||
else {
|
else {
|
||||||
|
@ -2432,7 +2434,8 @@ function menu_set_active_trail($new_trail = NULL) {
|
||||||
}
|
}
|
||||||
$tree = $curr['below'] ? $curr['below'] : array();
|
$tree = $curr['below'] ? $curr['below'] : array();
|
||||||
}
|
}
|
||||||
list($key, $curr) = each($tree);
|
$curr = current($tree);
|
||||||
|
next($tree);
|
||||||
}
|
}
|
||||||
// Make sure the current page is in the trail to build the page title, by
|
// Make sure the current page is in the trail to build the page title, by
|
||||||
// appending either the preferred link or the menu router item for the
|
// appending either the preferred link or the menu router item for the
|
||||||
|
|
|
@ -404,7 +404,11 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
|
||||||
// Create an associative array with weights as values.
|
// Create an associative array with weights as values.
|
||||||
$module_list = array_flip(array_values($module_list));
|
$module_list = array_flip(array_values($module_list));
|
||||||
|
|
||||||
while (list($module) = each($module_list)) {
|
// The array is iterated over manually (instead of using a foreach) because
|
||||||
|
// modules may be added to the list within the loop and we need to process
|
||||||
|
// them.
|
||||||
|
while ($module = key($module_list)) {
|
||||||
|
next($module_list);
|
||||||
if (!isset($module_data[$module])) {
|
if (!isset($module_data[$module])) {
|
||||||
// This module is not found in the filesystem, abort.
|
// This module is not found in the filesystem, abort.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -540,7 +544,11 @@ function module_disable($module_list, $disable_dependents = TRUE) {
|
||||||
$module_list = array_flip(array_values($module_list));
|
$module_list = array_flip(array_values($module_list));
|
||||||
|
|
||||||
$profile = drupal_get_profile();
|
$profile = drupal_get_profile();
|
||||||
while (list($module) = each($module_list)) {
|
// The array is iterated over manually (instead of using a foreach) because
|
||||||
|
// modules may be added to the list within the loop and we need to process
|
||||||
|
// them.
|
||||||
|
while ($module = key($module_list)) {
|
||||||
|
next($module_list);
|
||||||
if (!isset($module_data[$module]) || !$module_data[$module]->status) {
|
if (!isset($module_data[$module]) || !$module_data[$module]->status) {
|
||||||
// This module doesn't exist or is already disabled, skip it.
|
// This module doesn't exist or is already disabled, skip it.
|
||||||
unset($module_list[$module]);
|
unset($module_list[$module]);
|
||||||
|
|
|
@ -768,11 +768,13 @@ function book_prev($book_link) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
$flat = book_get_flat_menu($book_link);
|
$flat = book_get_flat_menu($book_link);
|
||||||
// Assigning the array to $flat resets the array pointer for use with each().
|
reset($flat);
|
||||||
$curr = NULL;
|
$curr = NULL;
|
||||||
do {
|
do {
|
||||||
$prev = $curr;
|
$prev = $curr;
|
||||||
list($key, $curr) = each($flat);
|
$curr = current($flat);
|
||||||
|
$key = key($flat);
|
||||||
|
next($flat);
|
||||||
} while ($key && $key != $book_link['mlid']);
|
} while ($key && $key != $book_link['mlid']);
|
||||||
|
|
||||||
if ($key == $book_link['mlid']) {
|
if ($key == $book_link['mlid']) {
|
||||||
|
@ -806,9 +808,10 @@ function book_prev($book_link) {
|
||||||
*/
|
*/
|
||||||
function book_next($book_link) {
|
function book_next($book_link) {
|
||||||
$flat = book_get_flat_menu($book_link);
|
$flat = book_get_flat_menu($book_link);
|
||||||
// Assigning the array to $flat resets the array pointer for use with each().
|
reset($flat);
|
||||||
do {
|
do {
|
||||||
list($key, $curr) = each($flat);
|
$key = key($flat);
|
||||||
|
next($flat);
|
||||||
}
|
}
|
||||||
while ($key && $key != $book_link['mlid']);
|
while ($key && $key != $book_link['mlid']);
|
||||||
|
|
||||||
|
|
|
@ -3188,11 +3188,7 @@ class LocaleLanguageNegotiationInfoFunctionalTest extends DrupalWebTestCase {
|
||||||
foreach (language_types_info() as $type => $info) {
|
foreach (language_types_info() as $type => $info) {
|
||||||
if (isset($info['fixed'])) {
|
if (isset($info['fixed'])) {
|
||||||
$negotiation = variable_get("language_negotiation_$type", array());
|
$negotiation = variable_get("language_negotiation_$type", array());
|
||||||
$equal = count($info['fixed']) == count($negotiation);
|
$equal = array_keys($negotiation) === array_values($info['fixed']);
|
||||||
while ($equal && list($id) = each($negotiation)) {
|
|
||||||
list(, $info_id) = each($info['fixed']);
|
|
||||||
$equal = $info_id == $id;
|
|
||||||
}
|
|
||||||
$this->assertTrue($equal, format_string('language negotiation for %type is properly set up', array('%type' => $type)));
|
$this->assertTrue($equal, format_string('language negotiation for %type is properly set up', array('%type' => $type)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue