From a82c4997d914be37b70b7ba8e75c51ce5dda3896 Mon Sep 17 00:00:00 2001 From: Karsten Nilsen Date: Sat, 27 Dec 2025 16:09:58 +0100 Subject: [PATCH] [FrankenPHP] Check for XDEBUG_SESSION cookie before connecting to debugger Only connect to the Xdebug client when the XDEBUG_SESSION cookie is set. This replicates the behavior in non-worker environments where the debugger only activates when explicitly enabled through the debug toolbar. --- src/frankenphp-symfony/src/Runner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frankenphp-symfony/src/Runner.php b/src/frankenphp-symfony/src/Runner.php index afb704d4..c1c12645 100644 --- a/src/frankenphp-symfony/src/Runner.php +++ b/src/frankenphp-symfony/src/Runner.php @@ -33,8 +33,8 @@ public function run(): int $server['APP_RUNTIME_MODE'] = 'web=1&worker=1'; $handler = function () use ($server, &$sfRequest, &$sfResponse, $xdebugConnectToClient): void { - // Connect to the Xdebug client if it's available - if ($xdebugConnectToClient) { + // Connect to the Xdebug client if it's available and the XDEBUG_SESSION cookie is set + if ($xdebugConnectToClient && isset($_COOKIE['XDEBUG_SESSION'])) { xdebug_connect_to_client(); }