From: Tim Düsterhus Date: Fri, 4 Jun 2021 10:08:20 +0000 (+0200) Subject: Return an IP address in Session::getIpAddress() X-Git-Tag: 5.4.0_Beta_2~30^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1fc7cef49c349fdfd2864322ae8d7a70bda763c;p=GitHub%2FWoltLab%2FWCF.git Return an IP address in Session::getIpAddress() --- diff --git a/wcfsetup/install/files/lib/system/session/Session.class.php b/wcfsetup/install/files/lib/system/session/Session.class.php index 9fe824431d..2de66d50cd 100644 --- a/wcfsetup/install/files/lib/system/session/Session.class.php +++ b/wcfsetup/install/files/lib/system/session/Session.class.php @@ -2,8 +2,8 @@ namespace wcf\system\session; +use wcf\util\IpAddress; use wcf\util\UserAgent; -use wcf\util\UserUtil; /** * Represents a session. @@ -84,11 +84,13 @@ final class Session } /** - * Returns the converted ip address of the session. + * Returns the last used ip address of the session. */ - public function getIpAddress(): string + public function getIpAddress(): IpAddress { - return UserUtil::convertIPv6To4($this->data['ipAddress']); + $ipAddress = new IpAddress($this->data['ipAddress']); + + return $ipAddress->asV4() ?: $ipAddress; } /**