From 6bf8f6bb26fcf056eed0423991d151904393f61f Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 18 Dec 2018 10:20:23 -0700 Subject: [PATCH] Fix some more PHP 7.2 warnings Remove some calls to deprecated each() --- addressbook/inc/class.addressbook_ui.inc.php | 14 +++++++------- calendar/inc/class.calendar_bo.inc.php | 2 +- calendar/inc/class.calendar_uiforms.inc.php | 8 ++++---- calendar/inc/class.calendar_uilist.inc.php | 2 +- infolog/inc/class.infolog_customfields.inc.php | 6 +++--- infolog/inc/class.infolog_ui.inc.php | 6 ++++-- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 166ea6d3c6..2a9dd521bc 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -132,13 +132,13 @@ class addressbook_ui extends addressbook_bo if (isset($_content['nm']['rows']['delete'])) // handle a single delete like delete with the checkboxes { - list($id) = @each($_content['nm']['rows']['delete']); + $id = @key($_content['nm']['rows']['delete']); $_content['nm']['action'] = 'delete'; $_content['nm']['selected'] = array($id); } if (isset($_content['nm']['rows']['document'])) // handle insert in default document button like an action { - list($id) = @each($_content['nm']['rows']['document']); + $id = @key($_content['nm']['rows']['document']); $_content['nm']['action'] = 'document'; $_content['nm']['selected'] = array($id); } @@ -172,12 +172,12 @@ class addressbook_ui extends addressbook_bo } if ($_content['nm']['rows']['infolog']) { - list($org) = each($_content['nm']['rows']['infolog']); + $org = key($_content['nm']['rows']['infolog']); return $this->infolog_org_view($org); } if ($_content['nm']['rows']['view']) // show all contacts of an organisation { - list($grouped_view) = each($_content['nm']['rows']['view']); + $grouped_view = key($_content['nm']['rows']['view']); } else { @@ -2315,7 +2315,7 @@ class addressbook_ui extends addressbook_bo if ($content['id']) { // last and next calendar date - list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); + $dates = current($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); if(is_array($dates)) $content += $dates; } @@ -2651,7 +2651,7 @@ class addressbook_ui extends addressbook_bo if(is_array($content)) { - list($button) = each($content['button']); + $button = key($content['button']); switch ($content['toolbar'] ? $content['toolbar'] : $button) { case 'vcard': @@ -2836,7 +2836,7 @@ class addressbook_ui extends addressbook_bo if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; // last and next calendar date - if (!empty($content['id'])) list(,$dates) = each($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); + if (!empty($content['id'])) $dates = current($this->read_calendar(array($content['account_id'] ? $content['account_id'] : 'c'.$content['id']),false)); if(is_array($dates)) $content += $dates; // Disable importexport diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index c5d0d0f6d8..48e724e2f5 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -889,7 +889,7 @@ class calendar_bo // check if the caller gave us enough information and if not read it from the DB if (!isset($event['participants']) || !isset($event['start']) || !isset($event['end'])) { - list(,$event_read) = each($this->so->read($event['id'])); + $event_read = current($this->so->read($event['id'])); if (!isset($event['participants'])) { $event['participants'] = $event_read['participants']; diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 5b3d6102fc..a0064b4e20 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -292,7 +292,7 @@ class calendar_uiforms extends calendar_ui // delete a recur-exception if ($content['recur_exception']['delete_exception']) { - list($date) = each($content['recur_exception']['delete_exception']); + $date = key($content['recur_exception']['delete_exception']); // eT2 converts time to if (!is_numeric($date)) $date = Api\DateTime::to (str_replace('Z','', $date), 'ts'); unset($content['recur_exception']['delete_exception']); @@ -317,7 +317,7 @@ class calendar_uiforms extends calendar_ui // delete an alarm if ($content['alarm']['delete_alarm']) { - list($id) = each($content['alarm']['delete_alarm']); + $id = key($content['alarm']['delete_alarm']); //echo "delete alarm $id"; _debug_array($content['alarm']['delete_alarm']); if ($content['id']) @@ -2097,7 +2097,7 @@ class calendar_uiforms extends calendar_ui else { //_debug_array($event); - list($button) = each($event['button']); + $button = key($event['button']); unset($event['button']); // clear notification errors @@ -2718,7 +2718,7 @@ class calendar_uiforms extends calendar_ui } if ($_content) { - list($button) = each($_content['button']); + $button = key($_content['button']); unset($_content['button']); if ($button != 'cancel') // store changed Acl { diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index ed57f45271..a1557b684c 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -95,7 +95,7 @@ class calendar_uilist extends calendar_ui { if ($_content['nm']['rows'][$button]) { - list($id) = each($_content['nm']['rows'][$button]); + $id = key($_content['nm']['rows'][$button]); $_content['nm']['action'] = $button; $_content['nm']['selected'] = array($id); } diff --git a/infolog/inc/class.infolog_customfields.inc.php b/infolog/inc/class.infolog_customfields.inc.php index a895050158..c281f989fa 100644 --- a/infolog/inc/class.infolog_customfields.inc.php +++ b/infolog/inc/class.infolog_customfields.inc.php @@ -96,7 +96,7 @@ class infolog_customfields extends admin_customfields if ($fields['delete']) { - list($delete) = each($fields['delete']); + $delete = key($fields['delete']); unset($fields['delete']); } @@ -180,7 +180,7 @@ class infolog_customfields extends admin_customfields if ($status['delete']) { - list($delete) = each($status['delete']); + $delete = key($status['delete']); unset($status['delete']); } @@ -254,7 +254,7 @@ class infolog_customfields extends admin_customfields unset($this->status[$content['type2']]); unset($this->status['defaults'][$content['type2']]); unset($this->group_owners[$content['type2']]); - list($content['type2']) = each($this->content_types); + $content['type2'] = key($this->content_types); // save changes to repository $this->save_repository(); diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 8d1c18e9ff..448427064d 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -887,7 +887,7 @@ class infolog_ui { if ($values['add']) { - list($type) = each($values['add']); + $type = key($values['add']); return $this->edit(0,$action,$action_id,$type,$called_as); } elseif ($values['cancel'] && $own_referer) @@ -901,7 +901,9 @@ class infolog_ui else { list($do,$do2) = each($values['main']); - list($do_id) = @each($do2); + $do = key($values['main']); + $do2 = current($values['main']); + $do_id = @key($do2); switch((string)$do) { case 'close':