Repository navigation
fix(activesync): read meeting requests with the Horde\Icalendar reader - #113
Merged
Merged
Conversation
A text/calendar part that repeated METHOD made the legacy Horde_Icalendar reader return an array, so HordeString::upper() raised a TypeError in EasMessageBuilder::_meetingRequest(). The error bypassed the exporter's Horde_ActiveSync_Exception handling and ended the request with HTTP 500, so the affected mail was retried on every sync. Read the iTip with the typed Horde\Icalendar model instead: - EasMessageBuilder reads METHOD once (default REQUEST, Bug #12083) and only attaches the meeting data after parsing succeeded. Unparseable calendars, events without a usable DTSTART and replies without ATTENDEE now leave the mail as a plain message instead of stalling the folder. - Message_MeetingRequest gets fromCalendar(VCalendar, ?CalendarMethod). fromvEvent() and getvEvent() remain as deprecated adapters for the consumers that still take the legacy vEvent. - Utils_Recurrence takes the typed Vevent and an explicit start date. - New Horde\ActiveSync\Calendar\CalendarTimeResolver resolves DATE and DATE-TIME values. The typed Vevent accessors only accept IANA TZIDs and throw on the Windows or custom names Outlook and Exchange send, so the resolver uses the calendar's own VTIMEZONE first (evaluated by VtimezoneOffsets), then IANA/Windows names, and finally the server time zone with a notice. Fixes #112
🔍 CI ResultsOverall: ❌ 12/12 lanes failed TL;DR: ❌ Quality issues: PHP-CS-Fixer: 48 files. Summary by PHP Version
Quality Metrics
❌ Failed Lanesphp8.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
php8.6-dev
php8.6-stable
CI powered by horde-components • View full results |
This was referenced Oct 30, 2026
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
Horde\Icalendarmodel instead of the legacyHorde_Icalendarproperty bag, so a repeated or multi-valuedMETHODcan no longer crash the sync.Fixes #112 (option C, as agreed with @ralflang).
Motivation
A
text/calendarpart with twoMETHODlines madeHorde_Icalendar::getAttributeDefault()return an array.HordeString::upper()then raised aTypeErrorinEasMessageBuilder::_meetingRequest(). ATypeErroris not aHorde_ActiveSync_Exception, so it reachedHorde_ErrorHandler::fatal()(HTTP 500) and the same mail was retried on every sync. The legacy API returnsstring|arrayfor any attribute, so the same class of bug applies toCLASS,STATUS,ORGANIZER,DTSTARTand others.Changes
EasMessageBuilder: parse withAbstractComponent::fromString(), readMETHODonce (defaultREQUEST, Bug #12083), log a repeatedMETHODat debug level.messageclass,contentclassandmeetingrequestare set only after parsing succeeded._getiTipStatus()takes the typed calendar and throwsHorde_ActiveSync_Exception(it used to throw an uncaughtHorde_Icalendar_Exception).Message_MeetingRequest: newfromCalendar(VCalendar, ?CalendarMethod);_parsevEvent()works on the typedVevent. Location is unescaped and decoded (quoted-printable/charset), an end time is derived fromDURATION, and the all-day check no longer breaks without an end time.fromvEvent()andgetvEvent()stay as@deprecatedadapters because the core driver and Kronolith'supdateAttendee()still need the legacy vEvent.Utils_Recurrence:detectInstanceType()/recurrenceFromVevent()take the typedVevent(and an explicit start date). Their only caller isMeetingRequest.src/Calendar/:CalendarTimeResolver:Zvalues, then the calendar's VTIMEZONE, then IANA/Windows names (TimezoneMapper), then the server time zone with a notice. Needed becauseVevent::getDtstart()throws on non-IANA TZIDs.VtimezoneOffsets: evaluates the UTC offset of a VTIMEZONE (yearlyBYMONTH+BYDAYrules,RDATE, single observances, expired rules). Anything else returns null, so the resolver falls back instead of guessing.ResolvedTime: value object.Exceptions caught
IcalendarException(interface)EasMessageBuilder::_meetingRequest()err, deliver the mail without meeting dataHorde_ActiveSync_Exceptionerr, deliver the mail without meeting dataHorde\Date\DateExceptionMeetingRequest::_parsevEvent()DURATION/ alarmTRIGGERis ignored,noticeHorde_Icalendar_ExceptionMeetingRequest::getvEvent()No
TypeError,ValueErroror bareExceptionis caught.Behaviour changes
CLASSandSTATUSare matched case-insensitively; a repeatedCLASSuses the first value.DTENDparsing.reminderis still exported in seconds.Test plan
vendor/bin/phpunit --bootstrap vendor/autoload.php test/unit/Horde/ActiveSync/Calendar/CalendarTimeResolverTest.php(22 tests).../Message/MeetingRequestTest.php(29 tests).../Imap/EasMessageBuilderMeetingRequestTest.php(13 tests, includes the repeatedMETHODregression)fromCalendar(): noThrowableother thanHorde_ActiveSync_Exception.VtimezoneOffsetscompared with PHP's tz database for the IANA-named zones in those fixtures (2008-2030): identical except where a fixture defines its own rules, and the legacy resolver deviates the same way there.