Skip to content

fix(activesync): load user flags through the mail API - #257

Merged
ralflang merged 1 commit into
FRAMEWORK_6_0from
fix/activesync-user-flags
Nov 13, 2026
Merged

ralflang merged 1 commit into
FRAMEWORK_6_0from
fix/activesync-user-flags

Conversation

@TDannhauer

Copy link
Copy Markdown
Contributor

Summary

  • Load ActiveSync user flags through the mail/msgflags capability instead of unserializing the mail app's msgflags preference.
  • Cache the map on the IMAP factory for the sync request.
  • Return an empty map when the mail app does not provide the capability or the call fails, so message sync continues.

Motivation

Horde_Core_ActiveSync_Imap_Factory::getMsgFlags() unserialized the mail app's msgflags preference with allowed_classes => false. IMP stores IMP_Flag_* objects in that preference, so each one came back as __PHP_Incomplete_Class. PHP warned twice per synced message, and the user's labels never reached the device.

#252. The class whitelist belongs to the application that defines the objects. IMP publishes the finished map as mail/msgflags.

Changes

  • getMsgFlags() calls $registry->call('mail/msgflags') when that capability exists.
  • Keywords are lowercased again here, which is what the ActiveSync category lookup expects.
  • A missing capability, a Horde_Exception from the call, or a non-array result is cached as an empty map. A failed call is logged at error level. A non-array result is logged at warning level.

Test plan

  • phpunit test/Unit/ActiveSync/ImapFactoryMsgflagsTest.php — capability hit and cache, missing capability, API failure, non-array result, non-scalar entries
  • With the IMP mail/msgflags change installed, sync a mailbox that has a user flag and confirm the device receives the label
  • Confirm the ActiveSync log no longer reports __PHP_Incomplete_Class while that mailbox syncs

Unserializing the msgflags preference with no allowed classes turned IMP flag objects into incomplete classes, which warned once per synced message and dropped the user's labels. Ask the mail app for mail/msgflags and cache the map for the request.
@TDannhauer

Copy link
Copy Markdown
Contributor Author

Pairs with horde/imp#126, which adds the mail/msgflags capability. This pull request returns an empty map when that capability is absent.

@ralflang ralflang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's useful.

@ralflang
ralflang merged commit 3037214 into FRAMEWORK_6_0 Nov 13, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants