aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2020-01-01 16:35:42 +0100
committerMarc Alexander <admin@m-a-styles.de>2020-01-01 16:35:42 +0100
commit7ae750214661214984e7944ef86698087ac7d2bd (patch)
tree9b7071dcc1a7e8662510aae431cf6e261e5c0bd9
parent7a294b5fcd7e38beb52bf3f899b483da476c0c59 (diff)
parent374dc92e8f5659f4035bee05a902e773fede1177 (diff)
downloadforums-7ae750214661214984e7944ef86698087ac7d2bd.tar
forums-7ae750214661214984e7944ef86698087ac7d2bd.tar.gz
forums-7ae750214661214984e7944ef86698087ac7d2bd.tar.bz2
forums-7ae750214661214984e7944ef86698087ac7d2bd.tar.xz
forums-7ae750214661214984e7944ef86698087ac7d2bd.zip
Merge pull request #5798 from rxu/ticket/16277
[ticket/16277] Move from each() function
-rw-r--r--phpBB/includes/acp/acp_permissions.php4
-rw-r--r--phpBB/includes/acp/auth.php21
-rw-r--r--phpBB/includes/diff/engine.php6
-rw-r--r--phpBB/includes/functions_convert.php3
-rw-r--r--phpBB/includes/mcp/mcp_logs.php2
-rw-r--r--phpBB/includes/mcp/mcp_notes.php2
-rw-r--r--phpBB/includes/mcp/mcp_warn.php2
-rw-r--r--phpBB/includes/ucp/ucp_groups.php16
-rw-r--r--phpBB/mcp.php2
-rw-r--r--phpBB/phpbb/request/type_cast_helper.php3
10 files changed, 29 insertions, 32 deletions
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index e683b1972e..59bf366c1b 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -694,8 +694,8 @@ class acp_permissions
}
// We loop through the auth settings defined in our submit
- list($ug_id, ) = each($psubmit);
- list($forum_id, ) = each($psubmit[$ug_id]);
+ $ug_id = key($psubmit);
+ $forum_id = key($psubmit[$ug_id]);
$settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST);
if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id]))
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index b414a3121a..f203f9d3ba 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -460,8 +460,7 @@ class auth_admin extends \phpbb\auth\auth
'S_GROUP_MODE' => ($user_mode == 'group') ? true : false)
);
- @reset($content_array);
- while (list($ug_id, $ug_array) = each($content_array))
+ foreach ($content_array as $ug_id => $ug_array)
{
// Build role dropdown options
$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;
@@ -471,8 +470,7 @@ class auth_admin extends \phpbb\auth\auth
$s_role_options = '';
$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;
- @reset($roles);
- while (list($role_id, $role_row) = each($roles))
+ foreach ($roles as $role_id => $role_row)
{
$role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']);
$role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name'];
@@ -559,8 +557,7 @@ class auth_admin extends \phpbb\auth\auth
'S_GROUP_MODE' => ($user_mode == 'group') ? true : false)
);
- @reset($content_array);
- while (list($forum_id, $forum_array) = each($content_array))
+ foreach ($content_array as $forum_id => $forum_array)
{
// Build role dropdown options
$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;
@@ -570,8 +567,7 @@ class auth_admin extends \phpbb\auth\auth
$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;
$s_role_options = '';
- @reset($roles);
- while (list($role_id, $role_row) = each($roles))
+ foreach ($roles as $role_id => $role_row)
{
$role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']);
$role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name'];
@@ -1138,8 +1134,7 @@ class auth_admin extends \phpbb\auth\auth
/* @var $phpbb_permissions \phpbb\permissions */
$phpbb_permissions = $phpbb_container->get('acl.permissions');
- @reset($category_array);
- while (list($cat, $cat_array) = each($category_array))
+ foreach ($category_array as $cat => $cat_array)
{
if (!$phpbb_permissions->category_defined($cat))
{
@@ -1169,8 +1164,7 @@ class auth_admin extends \phpbb\auth\auth
}
unset($key_array, $values_array);
*/
- @reset($cat_array['permissions']);
- while (list($permission, $allowed) = each($cat_array['permissions']))
+ foreach ($cat_array['permissions'] as $permission => $allowed)
{
if (!$phpbb_permissions->permission_defined($permission))
{
@@ -1237,8 +1231,7 @@ class auth_admin extends \phpbb\auth\auth
$permissions = $permission_row[$forum_id];
ksort($permissions);
- @reset($permissions);
- while (list($permission, $auth_setting) = each($permissions))
+ foreach ($permissions as $permission => $auth_setting)
{
$cat = $phpbb_permissions->get_permission_category($permission);
diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php
index 757fdadde9..0d73db02da 100644
--- a/phpBB/includes/diff/engine.php
+++ b/phpBB/includes/diff/engine.php
@@ -285,8 +285,9 @@ class diff_engine
$matches = $ymatches[$line];
reset($matches);
- while (list(, $y) = each($matches))
+ while ($y = current($matches))
{
+ next($matches);
if (empty($this->in_seq[$y]))
{
$k = $this->_lcs_pos($y);
@@ -296,8 +297,9 @@ class diff_engine
}
// no reset() here
- while (list(, $y) = each($matches))
+ while ($y = current($matches))
{
+ next($matches);
if ($y > $this->seq[$k - 1])
{
// Optimization: this is a common case: next match is just replacing previous match.
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php
index df4c9b1875..96e108792d 100644
--- a/phpBB/includes/functions_convert.php
+++ b/phpBB/includes/functions_convert.php
@@ -1209,7 +1209,8 @@ function get_config()
if (is_array($convert->config_schema['table_format']))
{
$convert_config = array();
- list($key, $val) = each($convert->config_schema['table_format']);
+ $key = key($convert->config_schema['table_format']);
+ $val = current($convert->config_schema['table_format']);
do
{
diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php
index 79f9d35ebe..dc098fceed 100644
--- a/phpBB/includes/mcp/mcp_logs.php
+++ b/phpBB/includes/mcp/mcp_logs.php
@@ -44,7 +44,7 @@ class mcp_logs
if (is_array($action))
{
- list($action, ) = each($action);
+ $action = key($action);
}
else
{
diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php
index a4c2356a43..74bd1f1f62 100644
--- a/phpBB/includes/mcp/mcp_notes.php
+++ b/phpBB/includes/mcp/mcp_notes.php
@@ -42,7 +42,7 @@ class mcp_notes
if (is_array($action))
{
- list($action, ) = each($action);
+ $action = key($action);
}
$this->page_title = 'MCP_NOTES';
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index df175133fc..7a8599fedd 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -41,7 +41,7 @@ class mcp_warn
if (is_array($action))
{
- list($action, ) = each($action);
+ $action = key($action);
}
$this->page_title = 'MCP_WARN';
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 2423af86be..d574549093 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -136,7 +136,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
$sql = 'SELECT group_type
FROM ' . GROUPS_TABLE . '
@@ -240,7 +240,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
@@ -460,7 +460,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
@@ -754,7 +754,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
@@ -879,7 +879,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
@@ -906,7 +906,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
@@ -985,7 +985,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
@@ -1046,7 +1046,7 @@ class ucp_groups
{
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
}
- list(, $row) = each($row);
+ $row = current($row);
if (!$row['group_leader'])
{
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 6215a675b4..c8fb0233ff 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -61,7 +61,7 @@ if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\requ
if (count($action_ary))
{
- list($action, ) = each($action_ary);
+ $action = key($action_ary);
}
unset($action_ary);
diff --git a/phpBB/phpbb/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php
index 912494998d..39d5908fd3 100644
--- a/phpBB/phpbb/request/type_cast_helper.php
+++ b/phpBB/phpbb/request/type_cast_helper.php
@@ -106,7 +106,8 @@ class type_cast_helper implements \phpbb\request\type_cast_helper_interface
return;
}
- list($default_key, $default_value) = each($default);
+ $default_key = key($default);
+ $default_value = current($default);
$key_type = gettype($default_key);
$_var = $var;