Skip to content

Commit

Permalink
Null coalescing for $_SERVER keys in session_handler.php
Browse files Browse the repository at this point in the history
Resolves CLI-invoked E_NOTICE in:
* e_session::getValidateData()
* e_core_session::challenge()
  • Loading branch information
Deltik committed Jan 17, 2020
1 parent 6fe4bf1 commit 4321c1b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions e107_handlers/session_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ public function getValidateData()
);

// collect ip data
if ($_SERVER['REMOTE_ADDR'])
if (isset($_SERVER['REMOTE_ADDR']))
{
$data['RemoteAddr'] = (string) $_SERVER['REMOTE_ADDR'];
}
Expand Down Expand Up @@ -1036,7 +1036,8 @@ public function challenge()
//$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);
Expand Down

0 comments on commit 4321c1b

Please sign in to comment.