fix PHP 8.0 TypeError: fwrite(): Argument #2 ($data) must be of type string, array given

This commit is contained in:
Ralf Becker 2021-11-13 17:30:57 +01:00
parent 587a9c0a88
commit 11e630da2a
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;