diff --git a/src/di.php b/src/di.php index a1bebe794..783d10ec9 100644 --- a/src/di.php +++ b/src/di.php @@ -397,7 +397,7 @@ $di['loggedin_client'] = function () use ($di) { * @throws \Box_Exception If the script is running in CLI or CGI mode and there is no cron admin available. */ $di['loggedin_admin'] = function () use ($di) { - if ('cli' === php_sapi_name() || str_starts_with(php_sapi_name(), 'cgi')) { + if ('cli' === php_sapi_name() || !http_response_code()) { return $di['mod_service']('staff')->getCronAdmin(); }