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; }