From: gggeek Date: Sat, 7 Apr 2018 00:30:38 +0000 (+0100) Subject: more removing of each() X-Git-Tag: 3.1.1~1 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=63ffec7c3caf3efa0d9e0ef7b4867da19fc156bf more removing of each() --- diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index 7aee62c..829a92d 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -2402,7 +2402,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha } // be tolerant to line endings, and extra empty lines $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); - while(list(,$line) = @each($ar)) + foreach($ar as $line) { // take care of multi-line headers and cookies $arr = explode(':',$line,2); @@ -2976,7 +2976,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha echo "$key => $val
"; if($key == 'array') { - while(list($key2, $val2) = each($val)) + foreach($val as $key2 => $val2) { echo "-- $key2 => $val2
"; } @@ -3188,8 +3188,8 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha function getval() { // UNSTABLE - reset($this->me); - list($a,$b)=each($this->me); + $b = reset($this->me); + $a = key($this->me); // contributed by I Sofer, 2001-03-24 // add support for nested arrays to scalarval // i've created a new method here, so as to @@ -3197,8 +3197,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha if(is_array($b)) { - @reset($b); - while(list($id,$cont) = @each($b)) + foreach($b as $id => $cont) { $b[$id] = $cont->scalarval(); } @@ -3208,13 +3207,11 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha if(is_object($b)) { $t = get_object_vars($b); - @reset($t); - while(list($id,$cont) = @each($t)) + foreach($t as $id => $cont) { $t[$id] = $cont->scalarval(); } - @reset($t); - while(list($id,$cont) = @each($t)) + foreach($t as $id => $cont) { @$b->$id = $cont; } @@ -3243,7 +3240,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha function scalartyp() { reset($this->me); - list($a,)=each($this->me); + $a = key($this->me); if($a==$GLOBALS['xmlrpcI4']) { $a=$GLOBALS['xmlrpcInt']; @@ -3376,8 +3373,8 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha case 'scalar': if (in_array('extension_api', $options)) { - reset($xmlrpc_val->me); - list($typ,$val) = each($xmlrpc_val->me); + $val = reset($xmlrpc_val->me); + $typ = key($xmlrpc_val->me); switch ($typ) { case 'dateTime.iso8601': @@ -3550,8 +3547,7 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha else { $arr = array(); - reset($php_val); - while(list($k,$v) = each($php_val)) + foreach($php_val as $k => $v) { $arr[$k] = php_xmlrpc_encode($v, $options); }