Bugfix: Undefined index: HTTP_USER_AGENT

This commit is contained in:
djmaze 2021-09-14 16:30:34 +02:00
parent 577c5f426e
commit c7b1a92ebf

View file

@ -215,7 +215,7 @@ class Service
$sContentSecurityPolicy = \preg_replace('/(img-src[^;]+)\\shttp:(\\s|;|$)/D', '$1$2', $sContentSecurityPolicy);
}
// Internet Explorer does not support 'nonce'
if (!\strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/') && !\strpos($_SERVER['HTTP_USER_AGENT'], 'Edge/1')) {
if (!isset($_SERVER['HTTP_USER_AGENT']) || (!\strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/') && !\strpos($_SERVER['HTTP_USER_AGENT'], 'Edge/1'))) {
if ($sScriptNonce) {
$sContentSecurityPolicy = \str_replace('script-src', "script-src 'nonce-{$sScriptNonce}'", $sContentSecurityPolicy);
}