Check if HTTP_USER_AGENT is set, use empty string otherwise

This commit is contained in:
jmechnich 2021-12-01 20:38:33 +01:00
parent 637758c13e
commit e676ca47dc
3 changed files with 9 additions and 3 deletions

View File

@ -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)) {

View File

@ -774,7 +774,9 @@ class ThreadProcessor extends ClientSideProcessor implements
// 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

View File

@ -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(),
);