From 2f664b1d0a2ad699479d952e97f005154c313159 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 14 Nov 2023 15:22:53 +0200 Subject: [PATCH] ignore SQL error "Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8mb3_general_ci,COERCIBLE) for operation '='" stalling mail for usernames with non-ascii chars --- api/src/Mail/Smtp/Sql.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/api/src/Mail/Smtp/Sql.php b/api/src/Mail/Smtp/Sql.php index 99c55d5b27..85eef0f226 100644 --- a/api/src/Mail/Smtp/Sql.php +++ b/api/src/Mail/Smtp/Sql.php @@ -140,12 +140,17 @@ class Sql extends Mail\Smtp { $account_id[] = $id; } - foreach($this->db->select(self::TABLE, 'account_id', array( - 'mail_type' => self::TYPE_ALIAS, - 'mail_value' => $user, - ), __LINE__, __FILE__, false, '', self::APP) as $row) - { - if (!in_array($row['account_id'], $account_id)) $account_id[] = $row['account_id']; + try { + foreach($this->db->select(self::TABLE, 'account_id', array( + 'mail_type' => self::TYPE_ALIAS, + 'mail_value' => $user, + ), __LINE__, __FILE__, false, '', self::APP) as $row) + { + if (!in_array($row['account_id'], $account_id)) $account_id[] = $row['account_id']; + } + } + catch (Api\Db\Exception $e) { + _egw_log_exception($e); // happens if username contains a non-ascii char } //error_log(__METHOD__."('$user') account_id=".array2string($account_id)); }