fix PHP 8.0 TypeError: explode() expects parameter 2 to be string, array given

This commit is contained in:
Ralf Becker 2021-11-10 11:38:06 +01:00
parent dc24bb7e37
commit ed9b735456

View File

@ -1855,7 +1855,10 @@ class addressbook_ui extends addressbook_bo
if ($query['grouped_view']) // view the contacts of one organisation only 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']); 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) foreach(explode('|||',$query['grouped_view']) as $part)
{ {
list($name,$value) = explode(':',$part,2); 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) 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']; $threshold = (int)$GLOBALS['egw_info']['user']['preferences']['addressbook']['duplicate_threshold'];
$ret = array('doublicates' => array(), 'msg' => null); $ret = array('doublicates' => array(), 'msg' => null);