From 519114ea1ac30ed256ea154ae2312824a91451f1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 10 Nov 2021 15:23:25 +0100 Subject: [PATCH] fix PHP 8.0 TypeError: strlen(): Argument #1 ($str) must be of type string, array given --- admin/inc/class.admin_mail.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index bcfe428a49..60a07707a3 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -431,12 +431,13 @@ class admin_mail 'acc_folder_archive' => array('', 'archive'), ) as $name => $common_names) { + unset($content[$name]); // first check special-use attributes if (($special_use = array_shift($common_names))) { foreach((array)$attributes[$special_use] as $mailbox) { - if (empty($content[$name]) || strlen($mailbox) < strlen($content[$name])) + if (empty($content[$name]) || is_string($mailbox) && strlen($mailbox) < strlen($content[$name])) { $content[$name] = $mailbox; } @@ -450,7 +451,7 @@ class admin_mail $delimiter = !empty($data['delimiter']) ? $data['delimiter'] : '.'; $name_parts = explode($delimiter, strtolower($mailbox)); if (array_intersect($name_parts, $common_names) && - (empty($content[$name]) || strlen($mailbox) < strlen($content[$name]) && substr($content[$name], 0, 6) != 'INBOX'.$delimiter)) + (empty($content[$name]) || is_string($mailbox) && strlen($mailbox) < strlen($content[$name]) && substr($content[$name], 0, 6) != 'INBOX'.$delimiter)) { //error_log(__METHOD__."() $mailbox --> ".substr($name, 11).' folder'); $content[$name] = $mailbox;