From 9a7c6dd411e23335fa8afef19503c59a209ecfe5 Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Tue, 31 Mar 2026 23:42:12 +0200 Subject: [PATCH 1/2] Refactor exception handling in ActiveSyncBackend Updated exception handling to include Throwable and use InjectorNotFoundException. --- lib/Horde/Core/Factory/ActiveSyncBackend.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Horde/Core/Factory/ActiveSyncBackend.php b/lib/Horde/Core/Factory/ActiveSyncBackend.php index 5175179a..3bdcdf44 100644 --- a/lib/Horde/Core/Factory/ActiveSyncBackend.php +++ b/lib/Horde/Core/Factory/ActiveSyncBackend.php @@ -1,6 +1,7 @@ get(ServerRequest::class); - } catch (Horde_Exception_NotFound $e) { + } catch (Throwable $e) { + // Injector throws Horde\Injector\NotFoundException when ServerRequest is + // unbound; legacy code threw Horde_Exception_NotFound. Both must use the + // superglobal fallback (PHP 7.4: no union catch). + if (!$e instanceof Horde_Exception_NotFound && !$e instanceof InjectorNotFoundException) { + throw $e; + } // Fallback: Create from PHP superglobals $serverRequest = new ServerRequest( $_SERVER['REQUEST_METHOD'] ?? 'GET', From c1b0e25303acd31204cad3ebc66306cf88b2c5fa Mon Sep 17 00:00:00 2001 From: Torben Dannhauer Date: Wed, 1 Apr 2026 16:15:32 +0200 Subject: [PATCH 2/2] Apply suggestion from @ralflang Co-authored-by: Ralf Lang --- lib/Horde/Core/Factory/ActiveSyncBackend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Horde/Core/Factory/ActiveSyncBackend.php b/lib/Horde/Core/Factory/ActiveSyncBackend.php index 3bdcdf44..dc01833b 100644 --- a/lib/Horde/Core/Factory/ActiveSyncBackend.php +++ b/lib/Horde/Core/Factory/ActiveSyncBackend.php @@ -16,7 +16,7 @@ public function create(Horde_Injector $injector) // Get PSR-7 ServerRequest from injector try { $serverRequest = $injector->get(ServerRequest::class); - } catch (Throwable $e) { + } catch (Horde_Exception_NotFound | InjectorNotFoundException $e) { // Injector throws Horde\Injector\NotFoundException when ServerRequest is // unbound; legacy code threw Horde_Exception_NotFound. Both must use the // superglobal fallback (PHP 7.4: no union catch).