From f8fadb0a6fcdcb49991236d04d8a0131dcd01987 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Thu, 9 Jul 2026 21:42:29 +0200 Subject: [PATCH] fix(activesync): guard null charset before strcasecmp in getMimePart() Horde_Mime_Part::getCharset() returns null for any non-text MIME part (attachments, inline images, etc.). getMimePart() passed that value directly into strcasecmp(), which is deprecated on PHP 8.1+ and logs a notice for every non-text part fetched during a sync -- flooding the log with "Passing null to parameter #1 ($string1) of type string is deprecated" warnings, as reported against Gmail/Nine on Android sync. Skip the ISO-8859-1 comparison when no charset is set instead of comparing against null. Behavior is unchanged: parts without a charset were never ISO-8859-1 anyway. Refs #77 --- lib/Horde/ActiveSync/Imap/Message.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Horde/ActiveSync/Imap/Message.php b/lib/Horde/ActiveSync/Imap/Message.php index d0647e48..babbbb7e 100644 --- a/lib/Horde/ActiveSync/Imap/Message.php +++ b/lib/Horde/ActiveSync/Imap/Message.php @@ -500,7 +500,8 @@ public function getMimePart($id, array $options = []) { $part = $this->basePart->getPart($id); if ($part - && (strcasecmp($part->getCharset(), 'ISO-8859-1') === 0)) { + && $part->getCharset() + && strcasecmp($part->getCharset(), 'ISO-8859-1') === 0) { $part->setCharset('windows-1252'); }