Fix some more PHP 7.2 warnings

Remove some calls to deprecated each()
This commit is contained in:
nathangray 2018-12-18 09:49:16 -07:00
parent 376be571ba
commit 19ead4c1cc
9 changed files with 11 additions and 9 deletions

View File

@ -1337,7 +1337,8 @@ class Contacts extends Contacts\Storage
if (!in_array($name,$this->org_fields)) continue; if (!in_array($name,$this->org_fields)) continue;
arsort($values,SORT_NUMERIC); arsort($values,SORT_NUMERIC);
list($value,$num) = each($values); $value = key($values);
$num = current($values);
if ($value && $num / (double) count($contacts) >= $this->org_common_factor) if ($value && $num / (double) count($contacts) >= $this->org_common_factor)
{ {
if (!in_array($name,$csvs)) if (!in_array($name,$csvs))

View File

@ -1077,7 +1077,7 @@ class Schema
break; break;
case 'array': case 'array':
case 'object': case 'object':
list(,$content) = @each($param); $content = @current($param);
$do_pre = is_array($param) ? count($param) > 6 || is_array($content)&&count($content) : True; $do_pre = is_array($param) ? count($param) > 6 || is_array($content)&&count($content) : True;
$param = ($do_pre ? '<pre>' : '').print_r($param,True).($do_pre ? '</pre>' : ''); $param = ($do_pre ? '<pre>' : '').print_r($param,True).($do_pre ? '</pre>' : '');
break; break;

View File

@ -310,7 +310,7 @@ class Nextmatch extends Etemplate\Widget
$filters = $valid_filters[$form_name]; $filters = $valid_filters[$form_name];
} }
// Avoid empty arrays, they cause problems with db filtering // Avoid empty arrays, they cause problems with db filtering
foreach((array)$filters['col_filter'] as $col => &$val) foreach((array)$filters['col_filter'] as $col => $val)
{ {
if(is_array($val) && count($val) == 0) if(is_array($val) && count($val) == 0)
{ {

View File

@ -432,7 +432,7 @@ class Vfs extends File
if (isset($params['mime'])) if (isset($params['mime']))
{ {
$content['showmime'] = true; $content['showmime'] = true;
list($content['mime']) = each($sel_options['mime']); $content['mime'] = key($sel_options['mime']);
} }
} }
elseif(isset($content['action'])) elseif(isset($content['action']))

View File

@ -779,7 +779,7 @@ abstract class Framework extends Framework\Extra
*/ */
protected static function _get_navbar_apps($svg=false) protected static function _get_navbar_apps($svg=false)
{ {
list($first) = each($GLOBALS['egw_info']['user']['apps']); $first = key($GLOBALS['egw_info']['user']['apps']);
if(is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin') if(is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin')
{ {
$newarray['admin'] = $GLOBALS['egw_info']['user']['apps']['admin']; $newarray['admin'] = $GLOBALS['egw_info']['user']['apps']['admin'];

View File

@ -119,7 +119,7 @@ class Login
if($last_loginid !== '') if($last_loginid !== '')
{ {
reset($GLOBALS['egw_domain']); reset($GLOBALS['egw_domain']);
list($default_domain) = each($GLOBALS['egw_domain']); $default_domain = key($GLOBALS['egw_domain']);
if(!empty ($last_domain) && $last_domain != $default_domain) if(!empty ($last_domain) && $last_domain != $default_domain)
{ {

View File

@ -1297,7 +1297,7 @@ tinymce.init({
$image1 = $image2 = $image3 = "'".$_leafImage."'"; $image1 = $image2 = $image3 = "'".$_leafImage."'";
if (($next_item = array_slice($_folders, $n+1, 1, true))) if (($next_item = array_slice($_folders, $n+1, 1, true)))
{ {
list($next_path) = each($next_item); $next_path = key($next_item);
if (substr($next_path,0,strlen($path)+1) == $path.'/') if (substr($next_path,0,strlen($path)+1) == $path.'/')
{ {
$image1 = $image2 = $image3 = '0'; $image1 = $image2 = $image3 = '0';

View File

@ -364,7 +364,7 @@ class Link extends Link\Storage
{ {
reset($app2); reset($app2);
$link_id = True; $link_id = True;
while ($link_id && list(,$link) = each($app2)) while ($link_id && $link = current($app2))
{ {
if (!is_array($link)) // check for unlink-marker if (!is_array($link)) // check for unlink-marker
{ {
@ -401,6 +401,7 @@ class Link extends Link\Storage
if (!($no_notify&1)) self::notify('link',$app1,$id1,$link['app'],$link['id'],$link_id); if (!($no_notify&1)) self::notify('link',$app1,$id1,$link['app'],$link['id'],$link_id);
break; break;
} }
next($app2);
} }
return $link_id; return $link_id;
} }

View File

@ -1396,7 +1396,7 @@ class Session
else else
{ {
reset($domains); reset($domains);
list($default_domain) = each($domains); $default_domain = key($domains);
} }
unset($domain_part); unset($domain_part);
} }