From d279eedc4ca9bbd9bd7d01834d0d7e59536cef5e Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Mon, 30 Dec 2024 22:12:32 -0700 Subject: [PATCH] Does a better job dealing with deprecation of SID constant This reverts commit 031326b902f39bb2dd4f27b2747d24180f4c4e1e. Signed-off-by: Jon Stovell --- Sources/QueryString.php | 17 ++++++++++------- Sources/Utils.php | 13 ++++++++----- 2 files changed, 18 insertions(+), 12 deletions(-) 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('/(?