From 104a992e359165cd04ecaeeceed8a08f77a505c4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 9 Dec 2023 08:47:35 +0100 Subject: [PATCH] Fix PHP8 warnings (#9242) --- CHANGELOG.md | 2 +- program/include/rcmail_attachment_handler.php | 3 ++- program/lib/Roundcube/rcube_message.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ff517d382a..11cbb5fdf8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ - Enigma: Fix finding of a private key when decrypting a message using GnuPG v2.3 - Fix page jump menu flickering on click (#9196) - Update to TinyMCE 5.10.9 security release (#9228) -- Fix PHP8 warnings (#9235, #9238) +- Fix PHP8 warnings (#9235, #9238, #9242) - Fix saving other encryption settings besides enigma's (#9240) - Fix unneeded php command use in installto.sh and deluser.sh scripts (#9237) diff --git a/program/include/rcmail_attachment_handler.php b/program/include/rcmail_attachment_handler.php index 3f4da7ddd2f..8f34781fbc6 100644 --- a/program/include/rcmail_attachment_handler.php +++ b/program/include/rcmail_attachment_handler.php @@ -60,8 +60,9 @@ public function __construct() if (!empty($uid)) { $rcube->config->set('prefer_html', true); $this->message = new rcube_message($uid, null, !empty($_GET['_safe'])); + $this->part = $this->message->mime_parts[$part_id] ?? null; - if ($this->part = $this->message->mime_parts[$part_id]) { + if ($this->part) { $this->filename = rcmail_action_mail_index::attachment_name($this->part); $this->mimetype = $this->part->mimetype; $this->size = $this->part->size; diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php index 7087b7423a8..e61d1d74720 100644 --- a/program/lib/Roundcube/rcube_message.php +++ b/program/lib/Roundcube/rcube_message.php @@ -1122,7 +1122,7 @@ function tnef_decode(&$part) $tpart->ctype_secondary = trim(strtolower($winatt['subtype'])); $tpart->mimetype = $tpart->ctype_primary . '/' . $tpart->ctype_secondary; $tpart->mime_id = 'winmail.' . $part->mime_id . '.' . $pid; - $tpart->size = $winatt['size']; + $tpart->size = $winatt['size'] ?? 0; $tpart->body = $winatt['stream']; if (!empty($winatt['content-id'])) {