From 1500ab69f0f66ab261b1a32574c4e3d691b214ce Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 28 Oct 2021 21:34:02 +0200 Subject: [PATCH] fix PHP 8.0 error: trim() expects parameter 1 to be string, array given --- addressbook/inc/class.addressbook_vcal.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.addressbook_vcal.inc.php b/addressbook/inc/class.addressbook_vcal.inc.php index 812466a1f4..f3c8013288 100644 --- a/addressbook/inc/class.addressbook_vcal.inc.php +++ b/addressbook/inc/class.addressbook_vcal.inc.php @@ -971,11 +971,12 @@ class addressbook_vcal extends addressbook_bo { if (!empty($fieldName)) { - $value = trim($vcardValues[$vcardKey]['values'][$fieldKey]); + $value = $vcardValues[$vcardKey]['values'][$fieldKey]; + if (is_string($value)) $value = trim($value); if ($pref_tel && (($vcardKey == $pref_tel) || - ($vcardValues[$vcardKey]['name'] == 'TEL') && - ($vcardValues[$vcardKey]['value'] == $vcardValues[$pref_tel]['value']))) + ($vcardValues[$vcardKey]['name'] == 'TEL') && + ($vcardValues[$vcardKey]['value'] == $vcardValues[$pref_tel]['value']))) { $contact['tel_prefer'] = $fieldName; }