Stop accessing the ->requestURI/Method properties of the session
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 14 Oct 2020 12:21:53 +0000 (14:21 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 15 Oct 2020 14:14:14 +0000 (16:14 +0200)
Use UserUtil / $_SERVER instead.

wcfsetup/install/files/lib/system/event/listener/SessionAccessLogListener.class.php
wcfsetup/setup/db/install.sql

index ccdfaf02c43e5cdea9a32cfea6b4ecbeed452d54..82b301de3a89016f8c64a9422ece1fa0dada8f90 100644 (file)
@@ -52,7 +52,7 @@ class SessionAccessLogListener implements IParameterizedEventListener {
                        }
                        
                        // format request uri
-                       $requestURI = WCF::getSession()->requestURI;
+                       $requestURI = UserUtil::getRequestURI();
                        // remove directories
                        $URIComponents = explode('/', $requestURI);
                        $requestURI = array_pop($URIComponents);
@@ -65,7 +65,7 @@ class SessionAccessLogListener implements IParameterizedEventListener {
                                'ipAddress' => UserUtil::getIpAddress(),
                                'time' => TIME_NOW,
                                'requestURI' => $requestURI,
-                               'requestMethod' => WCF::getSession()->requestMethod,
+                               'requestMethod' => substr($_SERVER['REQUEST_METHOD'] ?? '', 0, 255),
                                'className' => get_class($eventObj)
                        ]);
                }
index 873574528e03c1715d1300b69a2e81c31b8f19c0..ee90113a581d9e245cccb7964aa594c9a1c10adb 100644 (file)
@@ -111,7 +111,7 @@ CREATE TABLE wcf1_acp_session_access_log (
        ipAddress VARCHAR(39) NOT NULL DEFAULT '',
        time INT(10) NOT NULL DEFAULT 0,
        requestURI VARCHAR(255) NOT NULL DEFAULT '',
-       requestMethod VARCHAR(7) NOT NULL DEFAULT '',
+       requestMethod VARCHAR(255) NOT NULL DEFAULT '',
        className VARCHAR(255) NOT NULL DEFAULT '',
        KEY sessionLogID (sessionLogID)
 );