wp/wp-includes/class-snoopy.php
changeset 16 a86126ab1dd4
parent 7 cf61fcea0001
child 21 48c4eec2b7e6
--- a/wp/wp-includes/class-snoopy.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/class-snoopy.php	Tue Dec 15 13:49:49 2020 +0100
@@ -183,7 +183,7 @@
 						$frameurls = $this->_frameurls;
 						$this->_frameurls = array();
 
-						while(list(,$frameurl) = each($frameurls))
+						foreach ( $frameurls as $frameurl )
 						{
 							if($this->_framedepth < $this->maxframes)
 							{
@@ -243,7 +243,7 @@
 					$frameurls = $this->_frameurls;
 					$this->_frameurls = array();
 
-					while(list(,$frameurl) = each($frameurls))
+					foreach ( $frameurls as $frameurl )
 					{
 						if($this->_framedepth < $this->maxframes)
 						{
@@ -341,7 +341,7 @@
 						$frameurls = $this->_frameurls;
 						$this->_frameurls = array();
 
-						while(list(,$frameurl) = each($frameurls))
+						foreach ( $frameurls as $frameurl )
 						{
 							if($this->_framedepth < $this->maxframes)
 							{
@@ -408,7 +408,7 @@
 					$frameurls = $this->_frameurls;
 					$this->_frameurls = array();
 
-					while(list(,$frameurl) = each($frameurls))
+					foreach ( $frameurls as $frameurl )
 					{
 						if($this->_framedepth < $this->maxframes)
 						{
@@ -629,13 +629,13 @@
 
 		// catenate the non-empty matches from the conditional subpattern
 
-		while(list($key,$val) = each($links[2]))
+		foreach ( $links[2] as $key => $val )
 		{
 			if(!empty($val))
 				$match[] = $val;
 		}
 
-		while(list($key,$val) = each($links[3]))
+		foreach ( $links[3] as $key => $val )
 		{
 			if(!empty($val))
 				$match[] = $val;
@@ -821,7 +821,7 @@
 		{
 			if(!is_array($this->rawheaders))
 				$this->rawheaders = (array)$this->rawheaders;
-			while(list($headerKey,$headerVal) = each($this->rawheaders))
+			foreach ( $this->rawheaders as $headerKey => $headerVal )
 				$headers .= $headerKey.": ".$headerVal."\r\n";
 		}
 		if(!empty($content_type)) {
@@ -985,7 +985,7 @@
 		{
 			if(!is_array($this->rawheaders))
 				$this->rawheaders = (array)$this->rawheaders;
-			while(list($headerKey,$headerVal) = each($this->rawheaders))
+			foreach ( $this->rawheaders as $headerKey => $headerVal )
 				$headers[] = $headerKey.": ".$headerVal;
 		}
 		if(!empty($content_type)) {
@@ -1204,9 +1204,9 @@
 		switch ($this->_submit_type) {
 			case "application/x-www-form-urlencoded":
 				reset($formvars);
-				while(list($key,$val) = each($formvars)) {
+				foreach ( $formvars as $key => $val ) {
 					if (is_array($val) || is_object($val)) {
-						while (list($cur_key, $cur_val) = each($val)) {
+						foreach ( $val as $cur_key => $cur_val ) {
 							$postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
 						}
 					} else
@@ -1218,9 +1218,9 @@
 				$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
 
 				reset($formvars);
-				while(list($key,$val) = each($formvars)) {
+				foreach ( $formvars as $key => $val ) {
 					if (is_array($val) || is_object($val)) {
-						while (list($cur_key, $cur_val) = each($val)) {
+						foreach ( $val as $cur_key => $cur_val ) {
 							$postdata .= "--".$this->_mime_boundary."\r\n";
 							$postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
 							$postdata .= "$cur_val\r\n";
@@ -1233,9 +1233,9 @@
 				}
 
 				reset($formfiles);
-				while (list($field_name, $file_names) = each($formfiles)) {
+				foreach ( $formfiles as $field_name => $file_names ) {
 					settype($file_names, "array");
-					while (list(, $file_name) = each($file_names)) {
+					foreach ( $file_names as $file_name ) {
 						if (!is_readable($file_name)) continue;
 
 						$fp = fopen($file_name, "r");