From e676ca47dc4906698cc04f1a35aa86927df96efa Mon Sep 17 00:00:00 2001 From: jmechnich Date: Wed, 1 Dec 2021 20:38:33 +0100 Subject: [PATCH] Check if HTTP_USER_AGENT is set, use empty string otherwise --- src/mibew/libs/chat.php | 4 +++- .../libs/classes/Mibew/RequestProcessor/ThreadProcessor.php | 4 +++- src/mibew/libs/track.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/mibew/libs/chat.php b/src/mibew/libs/chat.php index ed88d34f..c24af18d 100644 --- a/src/mibew/libs/chat.php +++ b/src/mibew/libs/chat.php @@ -644,7 +644,9 @@ function chat_start_for_user( ) { // Get user info $remote_host = get_remote_host(); - $user_browser = $_SERVER['HTTP_USER_AGENT']; + $user_browser = isset($_SERVER['HTTP_USER_AGENT']) + ? $_SERVER['HTTP_USER_AGENT'] + : ''; // Check connection limit if (Thread::connectionLimitReached($remote_host)) { diff --git a/src/mibew/libs/classes/Mibew/RequestProcessor/ThreadProcessor.php b/src/mibew/libs/classes/Mibew/RequestProcessor/ThreadProcessor.php index 58beed66..a365f7df 100644 --- a/src/mibew/libs/classes/Mibew/RequestProcessor/ThreadProcessor.php +++ b/src/mibew/libs/classes/Mibew/RequestProcessor/ThreadProcessor.php @@ -774,7 +774,9 @@ protected function apiProcessLeaveMessage($args) // Create thread for left message $remote_host = get_remote_host(); - $user_browser = $_SERVER['HTTP_USER_AGENT']; + $user_browser = isset($_SERVER['HTTP_USER_AGENT']) + ? $_SERVER['HTTP_USER_AGENT'] + : ''; $visitor = visitor_from_request(); // Get message locale diff --git a/src/mibew/libs/track.php b/src/mibew/libs/track.php index 9f1189cd..cc582d6d 100644 --- a/src/mibew/libs/track.php +++ b/src/mibew/libs/track.php @@ -187,7 +187,9 @@ function track_get_path($visitor) function track_build_details() { $result = array( - 'user_agent' => $_SERVER['HTTP_USER_AGENT'], + 'user_agent' => (isset($_SERVER['HTTP_USER_AGENT']) + ? $_SERVER['HTTP_USER_AGENT'] + : ''), 'remote_host' => get_remote_host(), );