viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix bugs in LSMTree readRecords

Chris Pollett [2024-01-22 21:Jan:nd]
Fix bugs in LSMTree readRecords
Filename
src/library/LSMTree.php
diff --git a/src/library/LSMTree.php b/src/library/LSMTree.php
index 5e38aa08b..e9c93e163 100644
--- a/src/library/LSMTree.php
+++ b/src/library/LSMTree.php
@@ -757,13 +757,13 @@ class Tier
             self::$cache[$name_hash] = $tmp; //move to end of array
             return $tmp;
         }
-        self::$cache[$name_hash] =
-            explode($delimiter, file_get_contents($filename));
-        if (count(self::$cache[$name_hash]) >= LSMTree::RECORD_CACHE_SIZE ||
+        $record = explode($delimiter, file_get_contents($filename));
+        self::$cache[$name_hash] = $record;
+        if (count(self::$cache) >= LSMTree::RECORD_CACHE_SIZE ||
             memory_get_usage() >
-            C\INDEX_FILE_MEMORY_LIMIT * C\MEMORY_FILL_FACTOR) {
+            metricToInt(C\INDEX_FILE_MEMORY_LIMIT) * C\MEMORY_FILL_FACTOR) {
             array_shift(self::$cache);
         }
-        return self::$cache[$name_hash];
+        return $record;
     }
 }
ViewGit