From 6162092618e28f4e6f0af2f015c9dd7fa8b2d0b1 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 18 Sep 2017 14:54:39 +0200 Subject: [PATCH] Catch undefined IP address in rare use cases such as CLI usage --- src/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Auth.php b/src/Auth.php index 5e414b4..f1209fa 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -50,7 +50,7 @@ final class Auth extends UserManager { $this->useHttps = $useHttps; $this->allowCookiesScriptAccess = $allowCookiesScriptAccess; - $this->ipAddress = empty($ipAddress) ? $_SERVER['REMOTE_ADDR'] : $ipAddress; + $this->ipAddress = !empty($ipAddress) ? $ipAddress : (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null); $this->initSession(); $this->enhanceHttpSecurity();