From ed9b735456ea7e59dd83e66068badf5fcf81b0c9 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 10 Nov 2021 11:38:06 +0100 Subject: [PATCH] fix PHP 8.0 TypeError: explode() expects parameter 2 to be string, array given --- addressbook/inc/class.addressbook_ui.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 3f50d10406..b13390e367 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1855,7 +1855,10 @@ class addressbook_ui extends addressbook_bo if ($query['grouped_view']) // view the contacts of one organisation only { if (strpos($query['grouped_view'],'*AND*') !== false) $query['grouped_view'] = str_replace('*AND*','&',$query['grouped_view']); - $fields = explode(',',$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']); + if (!is_array($fields = $GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields'] ?? [])) + { + $fields = explode(',', $fields); + } foreach(explode('|||',$query['grouped_view']) as $part) { list($name,$value) = explode(':',$part,2); @@ -2911,7 +2914,10 @@ class addressbook_ui extends addressbook_bo */ public function ajax_check_values($values, $name, $own_id=0) { - $fields = explode(',',$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields']); + if (!is_array($fields = $GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_fields'] ?? [])) + { + $fields = explode(',', $fields); + } $threshold = (int)$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_threshold']; $ret = array('doublicates' => array(), 'msg' => null);