fix(activesync): guard null charset before strcasecmp in getMimePart()#80
Merged
Merged
Conversation
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
🔍 CI ResultsOverall: ❌ 12/12 lanes failed TL;DR: ❌ Quality issues: PHPUnit: 36 tests failed; PHPStan: 331 unique errors in 8 lanes; PHP-CS-Fixer: 18 files. Summary by PHP Version
Quality Metrics
❌ Failed Lanesphp8.0-dev
php8.0-stable
php8.1-dev
php8.1-stable
php8.2-dev
php8.2-stable
php8.3-dev
php8.3-stable
php8.4-dev
php8.4-stable
php8.5-dev
php8.5-stable
CI powered by horde-components • View full results |
ralflang
added a commit
that referenced
this pull request
Jul 18, 2026
Release version 3.1.0 fix(sync): emit SYNC_MODIFY replies for EAS 16 email modifies fix(activesync): throttle deferred-import keep-alive tokens fix(activesync): address streaming review findings docs(activesync): restructure documentation by audience feat(activesync): defer up-sync imports and emit WBXML keep-alives when streaming docs(activesync): note batch-size vector consolidation for Horde 6 feat(activesync): stream Sync responses incrementally Merge pull request #82 from horde/fix/settings-oof-empty-msgs fix(activesync): guard empty OOF messages in Settings response docs(todo): document folder UID map long-term work docs(activesync): explain crc32 mask in folder UID generation Merge pull request #81 from horde/fix/deterministic-folder-uids-moveitems-gone Potential fix for pull request finding Potential fix for pull request finding Potential fix for pull request finding fix(activesync): stabilize folder UIDs after hierarchy changes Merge pull request #80 from horde/fix/imap-mimepart-null-charset fix(activesync): guard null charset before strcasecmp in getMimePart()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nullcharset before callingstrcasecmp()inHorde_ActiveSync_Imap_Message::getMimePart()Motivation
Horde_Mime_Part::getCharset()returnsnullfor any non-text MIME part (attachments, inline images, etc.).getMimePart()passed that value directly intostrcasecmp(), which on PHP 8.1+ deprecates passingnullto a non-nullable string parameter. SincegetMimePart()runs for every MIME part fetched during a sync, this produces a "Passing null to parameter #1 ($string1) of type string is deprecated" notice for every non-text part of every synced message -- a significant amount of log I/O on accounts with attachments, and a plausible contributor to the erratic sync behavior reported in #77.Changes
lib/Horde/ActiveSync/Imap/Message.php: only run theISO-8859-1comparison when the part actually has a charset; behavior is unchanged (parts without a charset were neverISO-8859-1).Test plan
Related to #77