Merge pull request #263 from jmechnich/check-user-agent

Check if HTTP_USER_AGENT is set, use empty string otherwise
This commit is contained in:
Fedor A. Fetisov 2021-12-03 19:32:56 +03:00 committed by GitHub
commit cd1e8adce3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(),
);