fix PHP 8.0 TypeError: strlen(): Argument #1 ($str) must be of type string, array given

This commit is contained in:
Ralf Becker 2022-01-17 21:35:31 +02:00
parent c9d5eb50db
commit b69de21bea

View File

@ -306,7 +306,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
{
$content = $is_jscontact ? JsContact::getJsCard($contact['id'], false) :
$handler->getVCard($contact['id'],$this->charset,false);
$props['getcontentlength'] = bytes($content);
$props['getcontentlength'] = bytes(is_array($content) ? json_encode($content) : $content);
$props['address-data'] = Api\CalDAV::mkprop(Api\CalDAV::CARDDAV, 'address-data', $content);
}
$files[] = $this->add_resource($path, $contact, $props);
@ -374,7 +374,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler
if ($address_data)
{
$content = $is_jscontact ? JsContact::getJsCardGroup($list, false) : $handler->getGroupVCard($list);
$props['getcontentlength'] = bytes($content);
$props['getcontentlength'] = bytes(is_array($content) ? json_encode($content) : $content);
$props['address-data'] = Api\CalDAV::mkprop(Api\CalDAV::CARDDAV, 'address-data', $content);
}
$files[] = $this->add_resource($path, $list, $props);