From 2b5828b0ecf4e8fd5d28cf38d40fba94d1052006 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Sat, 27 Mar 2021 18:39:52 -0700 Subject: [PATCH] SmrSession: remove references in for loops See #317. --- src/lib/Default/SmrSession.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/Default/SmrSession.class.php b/src/lib/Default/SmrSession.class.php index 0bbc5c017..da063c4c4 100644 --- a/src/lib/Default/SmrSession.class.php +++ b/src/lib/Default/SmrSession.class.php @@ -243,7 +243,7 @@ public static function fetchVarInfo() { self::$game_id = 0; self::$var = array(); } else { - foreach (self::$var as $key => &$value) { + foreach (self::$var as $key => $value) { if ($value['Expires'] > 0 && $value['Expires'] <= self::getTime()) { // Use 0 for infinity //This link is no longer valid unset(self::$var[$key]); @@ -251,12 +251,12 @@ public static function fetchVarInfo() { //This link is no longer valid unset(self::$var[$key]); } else { - --$value['RemainingPageLoads']; + --self::$var[$key]['RemainingPageLoads']; if (isset($value['CommonID'])) { self::$commonIDs[$value['CommonID']] = $key; } } - } unset($value); + } } } else { self::$generate = true; @@ -268,12 +268,12 @@ public static function fetchVarInfo() { } public static function update() { - foreach (self::$var as $key => &$value) { + foreach (self::$var as $key => $value) { if ($value['RemainingPageLoads'] <= 0) { //This link was valid this load but will not be in the future, removing it now saves database space and data transfer. unset(self::$var[$key]); } - } unset($value); + } $compressed = gzcompress(serialize(self::$var)); if (!self::$generate) { self::$db->query('UPDATE active_session SET account_id=' . self::$db->escapeNumber(self::$account_id) . ',game_id=' . self::$db->escapeNumber(self::$game_id) . (!USING_AJAX ? ',last_accessed=' . self::$db->escapeNumber(self::getTime()) : '') . ',session_var=' . self::$db->escapeBinary($compressed) .