From 11ae13d8803d7bea6dbb028c3b2d8523699daf6f Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Wed, 8 Jul 2026 08:24:15 +0200 Subject: [PATCH] fix(activesync): report no folder changes when getFolderList() is false _getFolderChanges() returned early when the backend's getFolderList() returned false without initializing $this->_changes, leaving it null. A later count($this->_changes) (e.g. via getChangeCount() or the FolderSync exporter) then fatals under PHP 8. Set $this->_changes to an empty array on this path so a backend that defers folder listing (for example when the mail server is temporarily unavailable) yields a clean "no changes" FOLDERSYNC instead of a fatal error or an empty-hierarchy diff that deletes the client's folders. --- lib/Horde/ActiveSync/State/Base.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Horde/ActiveSync/State/Base.php b/lib/Horde/ActiveSync/State/Base.php index 5aa1e99a..5235d347 100644 --- a/lib/Horde/ActiveSync/State/Base.php +++ b/lib/Horde/ActiveSync/State/Base.php @@ -800,6 +800,12 @@ protected function _getFolderChanges() $this->_logger->meta('STATE: Initializing folder diff engine'); $folderlist = $this->_backend->getFolderList(); if ($folderlist === false) { + // The backend could not produce a folder list (e.g. the mail + // server is temporarily unavailable). Report no changes rather + // than leaving $this->_changes unset (which would fatal on a + // later count()) or diffing against an empty list (which would + // delete the client's folders). + $this->_changes = []; return false; } // @TODO Remove in H6. We need to ensure we have 'serverid' in the