From 60536222ce67fc8a7b23c75b3d673c9bf6a293ed Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 14 Oct 2021 09:39:01 +0200 Subject: [PATCH] fix PHP 8.0 error forwarding mail as attachment (calling count on null) --- api/src/loader/exception.php | 2 ++ mail/inc/class.mail_compose.inc.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/loader/exception.php b/api/src/loader/exception.php index eb50137608..43750b6afd 100755 --- a/api/src/loader/exception.php +++ b/api/src/loader/exception.php @@ -118,6 +118,8 @@ function egw_exception_handler($e) $message = '

'.Api\Html::htmlspecialchars($headline)."

\n". '
'.Api\Html::htmlspecialchars($e->getMessage())."\n\n";
 
+		echo $e->getFile().' ('.$e->getLine().")\n";
+
 		// only show trace (incl. function arguments) if explicitly enabled, eg. on a development system
 		if ($GLOBALS['egw_info']['server']['exception_show_trace'])
 		{
diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php
index 164f538b80..af7d42e33d 100644
--- a/mail/inc/class.mail_compose.inc.php
+++ b/mail/inc/class.mail_compose.inc.php
@@ -2022,7 +2022,7 @@ class mail_compose
 			'size'		=> $_size,
 			'folder'	=> $_folder,
 			'winmailFlag' => $_is_winmail,
-			'tmp_name'	=> mail_ui::generateRowID($this->mail_bo->profileID, $_folder, $_uid).'_'.(!empty($_partID)?$_partID:count($this->sessionData['attachments'])+1),
+			'tmp_name'	=> mail_ui::generateRowID($this->mail_bo->profileID, $_folder, $_uid).'_'.(!empty($_partID)?$_partID:count($this->sessionData['attachments'] ?? [])+1),
 		);
 	}