Skip to content

Fix/activesync for kronolith#35

Open
TDannhauer wants to merge 2 commits into
FRAMEWORK_6_0from
fix/activesync_for_kronolith
Open

Fix/activesync for kronolith#35
TDannhauer wants to merge 2 commits into
FRAMEWORK_6_0from
fix/activesync_for_kronolith

Conversation

@TDannhauer
Copy link
Copy Markdown
Contributor

Fix ActiveSync FolderDelete state and WBXML handling

Summary

  • Treat ActiveSync FolderDelete as a client-originated change when updating folder state.
  • Avoid sending FolderDelete through the server-change bookkeeping path where pending changes may be null.
  • Remove an extra WBXML endTag() from the FolderCreate/FolderUpdate/FolderDelete request handler.

Problem

iOS FolderDelete completed successfully at the protocol level, but Horde logged PHP warnings during the request:

  • foreach() argument must be of type array|object, null given in Horde_ActiveSync_State_Sql::updateState()
  • Trying to access array offset on null in Horde_ActiveSync_Wbxml_Encoder::endTag()

The first warning came from Horde_ActiveSync_Connector_Importer::importFolderDeletion(). FolderDelete is initiated by the client, but the importer updated state with CHANGE_ORIGIN_NA. That sent SQL state handling down the server-change path, where _changes can be null for this request.

The second warning came from Horde_ActiveSync_Request_FolderCreate, which handles FolderCreate, FolderUpdate, and FolderDelete responses. Each branch already opens and closes its own root response tag, but the method had one additional unconditional endTag() after the branch. For FolderDelete this popped an empty encoder stack after a valid response had already been produced.

Solution

Horde_ActiveSync_Connector_Importer::importFolderDeletion() now calls updateState() with CHANGE_ORIGIN_PIM.

That matches the actual origin of FolderDelete, avoids the wrong server-change bookkeeping path, and prevents the foreach() warning in SQL state handling.

Horde_ActiveSync_Request_FolderCreate no longer emits the extra unconditional endTag() after the create/update/delete branch. The response branch remains responsible for closing the root response tag it opened.

Files changed

  • vendor/horde/activesync/lib/Horde/ActiveSync/Connector/Importer.php
  • vendor/horde/activesync/lib/Horde/ActiveSync/Request/FolderCreate.php

Validation

  • php -l completed successfully for the edited ActiveSync PHP files.
  • Cursor lints reported no errors for the edited ActiveSync files.
  • Manual iOS FolderDelete testing confirmed the request returns success and no further Horde error logs appeared for the tested deletion path after the WBXML fix.

Test plan

  • Delete an ActiveSync calendar folder from iOS and confirm the FolderDelete response returns status 1.
  • Confirm the FolderDelete response includes a new accepted FolderSync key.
  • Confirm the following FolderSync completes cleanly.
  • Check /tmp-horde/horde.log; confirm no warning from Horde_ActiveSync_State_Sql::updateState() during FolderDelete.
  • Check /tmp-horde/horde.log; confirm no warning from Horde_ActiveSync_Wbxml_Encoder::endTag() during FolderDelete.
  • Repeat FolderCreate and FolderUpdate from an ActiveSync client to confirm their responses still contain balanced WBXML and accepted synckeys.

Notes

This change is intentionally protocol-level and application-neutral. It does not change how Kronolith, Nag, Turba, or Mnemo create/delete their folders; it only fixes common ActiveSync FolderDelete state and response handling.

Removed redundant endTag call in FolderCreate.php.
traverse the right logic path
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.

1 participant