From c212cf36ae3b3de9feaf064cc07865180782c489 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 13 Nov 2021 17:30:57 +0100 Subject: [PATCH] fix PHP 8.0 TypeError: fwrite(): Argument #2 ($data) must be of type string, array given --- api/src/Mail.php | 4 ++-- mail/inc/class.mail_ui.inc.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/Mail.php b/api/src/Mail.php index 5642fba221..0a7c08eb9e 100644 --- a/api/src/Mail.php +++ b/api/src/Mail.php @@ -5574,12 +5574,12 @@ class Mail * @param string/int $_partID = '' , the partID, may be omitted * @param string $_folder folder to work on * @param boolean $_stream =false true: return a stream, false: return string, stream suppresses any caching - * @return string the message body + * @return ?string the message body or null if $_uid or $_partID not found */ function getMessageRawBody($_uid, $_partID = '', $_folder='', $_stream=false) { static $rawBody; - $body = []; + $body = null; if (empty($_folder)) $_folder = $this->sessionData['mailbox']?: $this->icServer->getCurrentMailbox(); $_uid = !(is_object($_uid) || is_array($_uid)) ? (array)$_uid : $_uid; diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 08dda2556f..c67f8b7b5c 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2965,7 +2965,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2); $file = $tmp_file; } - if (!($fp = Vfs::fopen($file,'wb')) || !fwrite($fp,$message)) + if (!is_string($message) || !($fp = Vfs::fopen($file,'wb')) || !fwrite($fp,$message)) { $res['msg'] = lang('Error saving %1!',$file); $res['success'] = false;