From ce64787b9464f5f53cca669694771e3a7099faa4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 14 Oct 2020 14:20:02 +0200 Subject: [PATCH] Stop accessing the ->userAgent property of the session Use UserUtil::getUserAgent() instead. --- wcfsetup/install/files/lib/system/WCF.class.php | 2 +- .../system/event/listener/SessionAccessLogListener.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 3ec0af5d03..5e57fc40ed 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -505,7 +505,7 @@ class WCF { } } if (defined('BLACKLIST_USER_AGENTS') && BLACKLIST_USER_AGENTS != '') { - if (!StringUtil::executeWordFilter(self::getSession()->userAgent, BLACKLIST_USER_AGENTS)) { + if (!StringUtil::executeWordFilter(UserUtil::getUserAgent(), BLACKLIST_USER_AGENTS)) { if ($isAjax) { throw new AJAXException(self::getLanguage()->getDynamicVariable('wcf.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS); } diff --git a/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php b/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php index 2135cae446..ccdfaf02c4 100644 --- a/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php @@ -44,7 +44,7 @@ class SessionAccessLogListener implements IParameterizedEventListener { 'userID' => WCF::getUser()->userID, 'ipAddress' => UserUtil::getIpAddress(), 'hostname' => @gethostbyaddr(UserUtil::getIpAddress()), - 'userAgent' => WCF::getSession()->userAgent, + 'userAgent' => UserUtil::getUserAgent(), 'time' => TIME_NOW, 'lastActivityTime' => TIME_NOW ]); -- 2.20.1