1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Null coalescing for $_SERVER keys in session_handler.php

Resolves CLI-invoked E_NOTICE in:
* e_session::getValidateData()
* e_core_session::challenge()
This commit is contained in:
Nick Liu 2020-01-17 15:54:12 +01:00
parent 6fe4bf16be
commit 4321c1b944
No known key found for this signature in database
GPG Key ID: 1167C5F9C9897637

View File

@ -711,7 +711,7 @@ class e_session
);
// collect ip data
if ($_SERVER['REMOTE_ADDR'])
if (isset($_SERVER['REMOTE_ADDR']))
{
$data['RemoteAddr'] = (string) $_SERVER['REMOTE_ADDR'];
}
@ -1036,7 +1036,8 @@ class e_core_session extends e_session
//$logfp = fopen(e_LOG.'authlog.txt', 'a+'); fwrite($logfp, strftime('%H:%M:%S').' CHAP start: '.$extra_text."\n"); fclose($logfp);
// could go, see _validate()
$ubrowser = md5('E107'.$_SERVER['HTTP_USER_AGENT']);
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$ubrowser = md5('E107'.$user_agent);
if (!$this->is('ubrowser'))
{
$this->set('ubrowser', $ubrowser);