Skip to content

Commit 5de845d

Browse files
committed
Merge pull request ILIAS-eLearning#11218 from mjansenDatabay/hotfix/10/46399
[FIX] Logging: Fix access to undefined array key `HTTP_ACCEPT`
1 parent 1d8a1b6 commit 5de845d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,31 @@ public function initUser(string $a_login): void
126126
*/
127127
protected function isConsoleAvailable(): bool
128128
{
129-
if (ilContext::getType() != ilContext::CONTEXT_WEB) {
129+
if (ilContext::getType() !== ilContext::CONTEXT_WEB) {
130130
return false;
131131
}
132-
if (
133-
$this->dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch() ||
132+
133+
if (($this->dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch()) ||
134134
(
135135
$this->dic->isDependencyAvailable('http') &&
136-
strtolower($this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? '') === 'xmlhttprequest'
136+
strtolower(
137+
$this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? ''
138+
) === 'xmlhttprequest'
137139
)
138140
) {
139141
return false;
140142
}
141143

142-
if (
143-
$this->dic->isDependencyAvailable('http') &&
144-
strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'text/html') !== false
145-
) {
144+
if ($this->dic->isDependencyAvailable('http') &&
145+
str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'text/html')) {
146146
return true;
147147
}
148-
if (
149-
$this->dic->isDependencyAvailable('http') &&
150-
strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'application/json') !== false
151-
) {
148+
149+
if ($this->dic->isDependencyAvailable('http') &&
150+
str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'application/json')) {
152151
return false;
153152
}
153+
154154
return true;
155155
}
156156

0 commit comments

Comments
 (0)