From 7670c3835e3eaacd4d4580f7b5bc2173cc0ad288 Mon Sep 17 00:00:00 2001 From: mjansen Date: Tue, 3 Mar 2026 12:36:20 +0100 Subject: [PATCH] [FIX] Logging: Fix access to undefined array key `HTTP_ACCEPT` See: https://mantis.ilias.de/view.php?id=46399 --- .../classes/public/class.ilLoggerFactory.php | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php b/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php index 497d789f69ed..7cc15fe47f4c 100755 --- a/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php +++ b/components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php @@ -1,7 +1,5 @@ dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch() || + if ($this->dic->isDependencyAvailable('ctrl') && ( - $this->dic->isDependencyAvailable('http') && - strtolower($this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? '') === 'xmlhttprequest' + $this->dic->ctrl()->isAsynch() || + ( + $this->dic->isDependencyAvailable('http') && + strtolower( + $this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? '' + ) === 'xmlhttprequest' + ) ) ) { return false; } - if ( - $this->dic->isDependencyAvailable('http') && - strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'text/html') !== false - ) { + if ($this->dic->isDependencyAvailable('http') && + str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'text/html')) { return true; } - if ( - $this->dic->isDependencyAvailable('http') && - strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'application/json') !== false - ) { + + if ($this->dic->isDependencyAvailable('http') && + str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'application/json')) { return false; } + return true; }