Permalink
Browse files

Replace potentially dangerous list() = each() constructs with foreach…

… to avoid problems like one described in #630.
  • Loading branch information...
1 parent 254e446 commit 74ec1a4da50df71fea85f382024b84132e9dd95a @trustmaster trustmaster committed Apr 3, 2011
View
2 plugins/adminqv/adminqv.php
@@ -72,7 +72,7 @@
$tables[] = $status1;
}
-while(list($i,$dat) = each($tables))
+foreach ($tables as $dat)
{
$table_length = $dat['Index_length']+$dat['Data_length'];
$total_length += $table_length;
View
6 system/core/admin/admin.plug.inc.php
@@ -104,7 +104,7 @@
/* === Hook - Part1 : Set === */
$extp = sed_getextplugins('admin.plug.details.part.loop');
/* ===== */
- while(list($i, $x) = each($parts))
+ foreach ($parts as $i => $x)
{
$extplugin_file = $cfg['plugins_dir']."/".$pl."/".$x;
$info_file = sed_infoget($extplugin_file, 'SED_EXTPLUGIN');
@@ -288,7 +288,7 @@
if(count($parts) > 0)
{
- while(list($i, $x) = each($parts))
+ foreach ($parts as $i => $x)
{
$extplugin_file = $cfg['plugins_dir']."/".$pl."/".$x;
$info_part = sed_infoget($extplugin_file, 'SED_EXTPLUGIN');
@@ -569,7 +569,7 @@
/* === Hook - Part1 : Set === */
$extp = sed_getextplugins('admin.plug.list.loop');
/* ===== */
- while(list($i, $x) = each($extplugins))
+ foreach($extplugins as $i => $x)
{
$extplugin_info = $cfg['plugins_dir']."/".$x."/".$x.".setup.php";
if(file_exists($extplugin_info))
View
2 system/core/admin/admin.tools.inc.php
@@ -111,7 +111,7 @@ function cmp($a, $b, $k = 1)
usort($plugins, "cmp");
- while(list($i, $x) = each($plugins))
+ foreach($plugins as $i => $x)
{
$extplugin_info = $cfg['plugins_dir']."/".$x[0]."/".$x[0].".setup.php";
View
2 system/core/list/list.inc.php
@@ -249,7 +249,7 @@
$extp = sed_getextplugins('list.rowcat.loop');
/* ===== */
-while (list($i,$x) = each($sed_cat))
+foreach ($sed_cat as $i => $x)
{
if(mb_substr($x['path'],0,$mtchlen)==$mtch && mb_substr_count($x['path'],".")==$mtchlvl && $mm<$dc)
{
View
4 system/functions.php
@@ -3722,7 +3722,7 @@ function sed_selectbox_lang($check, $name)
sort($langlist);
$result = "<select name=\"$name\" size=\"1\">";
- while(list($i,$x) = each($langlist))
+ foreach ($langlist as $i => $x)
{
$selected = ($x==$check) ? "selected=\"selected\"" : '';
$lng = (empty($sed_languages[$x])) ? $sed_countries[$x] : $sed_languages[$x];
@@ -3775,7 +3775,7 @@ function sed_selectbox_skin($check, $name)
sort($skinlist);
$result = '<select name="'.$name.'" size="1">';
- while(list($i,$x) = each($skinlist))
+ foreach($skinlist as $i => $x)
{
$selected = ($x==$check) ? 'selected="selected"' : '';
$skininfo = "skins/$x/$x.php";

0 comments on commit 74ec1a4

Please sign in to comment.