diff --git a/Sources/QueryString.php b/Sources/QueryString.php index 7a113c46fe..7ab89d4bc6 100644 --- a/Sources/QueryString.php +++ b/Sources/QueryString.php @@ -414,14 +414,17 @@ public static function isFilteredRequest(array $value_list, string $var): bool */ public static function ob_sessrewrite(string $buffer): string { - // If Config::$scripturl is set to nothing, or the session ID is not defined (SSI?) just quit. - if (Config::$scripturl == '' || session_id() === false) { + // PHP 8.4 deprecated SID. A better long-term solution is needed, but this works for now. + $sid = defined('SID') ? @constant('SID') : null; + + // If Config::$scripturl is set to nothing, or the SID is not defined (SSI?) just quit. + if (Config::$scripturl == '' || !isset($sid)) { return $buffer; } // Do nothing if the session is cookied, or they are a crawler - guests are caught by redirectexit(). - if (empty($_COOKIE) && session_id() != '' && !BrowserDetector::isBrowser('possibly_robot')) { - $buffer = preg_replace('/(?