Skip to content
This repository
Browse code

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

… to avoid problems like one described in #630.
  • Loading branch information...
commit 74ec1a4da50df71fea85f382024b84132e9dd95a 1 parent 254e446
Vladimir Sibirov authored April 03, 2011
2  plugins/adminqv/adminqv.php
@@ -72,7 +72,7 @@
72 72
 	$tables[] = $status1;
73 73
 }
74 74
 
75  
-while(list($i,$dat) = each($tables))
  75
+foreach ($tables as $dat)
76 76
 {
77 77
 	$table_length = $dat['Index_length']+$dat['Data_length'];
78 78
 	$total_length += $table_length;
6  system/core/admin/admin.plug.inc.php
@@ -104,7 +104,7 @@
104 104
 				/* === Hook - Part1 : Set === */
105 105
 				$extp = sed_getextplugins('admin.plug.details.part.loop');
106 106
 				/* ===== */
107  
-				while(list($i, $x) = each($parts))
  107
+				foreach ($parts as $i => $x)
108 108
 				{
109 109
 					$extplugin_file = $cfg['plugins_dir']."/".$pl."/".$x;
110 110
 					$info_file = sed_infoget($extplugin_file, 'SED_EXTPLUGIN');
@@ -288,7 +288,7 @@
288 288
 
289 289
 					if(count($parts) > 0)
290 290
 					{
291  
-						while(list($i, $x) = each($parts))
  291
+						foreach ($parts as $i => $x)
292 292
 						{
293 293
 							$extplugin_file = $cfg['plugins_dir']."/".$pl."/".$x;
294 294
 							$info_part = sed_infoget($extplugin_file, 'SED_EXTPLUGIN');
@@ -569,7 +569,7 @@
569 569
 		/* === Hook - Part1 : Set === */
570 570
 		$extp = sed_getextplugins('admin.plug.list.loop');
571 571
 		/* ===== */
572  
-		while(list($i, $x) = each($extplugins))
  572
+		foreach($extplugins as $i => $x)
573 573
 		{
574 574
 			$extplugin_info = $cfg['plugins_dir']."/".$x."/".$x.".setup.php";
575 575
 			if(file_exists($extplugin_info))
2  system/core/admin/admin.tools.inc.php
@@ -111,7 +111,7 @@ function cmp($a, $b, $k = 1)
111 111
 
112 112
 		usort($plugins, "cmp");
113 113
 
114  
-		while(list($i, $x) = each($plugins))
  114
+		foreach($plugins as $i => $x)
115 115
 		{
116 116
 			$extplugin_info = $cfg['plugins_dir']."/".$x[0]."/".$x[0].".setup.php";
117 117
 
2  system/core/list/list.inc.php
@@ -249,7 +249,7 @@
249 249
 $extp = sed_getextplugins('list.rowcat.loop');
250 250
 /* ===== */
251 251
 
252  
-while (list($i,$x) = each($sed_cat))
  252
+foreach ($sed_cat as $i => $x)
253 253
 {
254 254
 	if(mb_substr($x['path'],0,$mtchlen)==$mtch && mb_substr_count($x['path'],".")==$mtchlvl && $mm<$dc)
255 255
 	{
4  system/functions.php
@@ -3722,7 +3722,7 @@ function sed_selectbox_lang($check, $name)
3722 3722
 	sort($langlist);
3723 3723
 
3724 3724
 	$result = "<select name=\"$name\" size=\"1\">";
3725  
-	while(list($i,$x) = each($langlist))
  3725
+	foreach ($langlist as $i => $x)
3726 3726
 	{
3727 3727
 		$selected = ($x==$check) ? "selected=\"selected\"" : '';
3728 3728
 		$lng = (empty($sed_languages[$x])) ? $sed_countries[$x] : $sed_languages[$x];
@@ -3775,7 +3775,7 @@ function sed_selectbox_skin($check, $name)
3775 3775
 	sort($skinlist);
3776 3776
 
3777 3777
 	$result = '<select name="'.$name.'" size="1">';
3778  
-	while(list($i,$x) = each($skinlist))
  3778
+	foreach($skinlist as $i => $x)
3779 3779
 	{
3780 3780
 		$selected = ($x==$check) ? 'selected="selected"' : '';
3781 3781
 		$skininfo = "skins/$x/$x.php";

0 notes on commit 74ec1a4

Please sign in to comment.
Something went wrong with that request. Please try again.