aboutsummaryrefslogtreecommitdiff
path: root/caches/SQLiteCache.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2023-07-20 19:11:13 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-20 19:11:13 +0200
commit0a118310cb123460e49778ec74791cb2d0b6ba6f (patch)
tree9e4278c51eb6b9a71d3750556cb26ed6cf56680e /caches/SQLiteCache.php
parent663729cf19da206e62cb65ddc4fdb151c66b3498 (diff)
downloadrss-bridge-0a118310cb123460e49778ec74791cb2d0b6ba6f.tar.gz
rss-bridge-0a118310cb123460e49778ec74791cb2d0b6ba6f.tar.zst
rss-bridge-0a118310cb123460e49778ec74791cb2d0b6ba6f.zip
fix(sqlitecache): store blob as blob (#3555)
serialize() can return output with null bytes and other non-text data. The prior behavior truncated data which later results in unserialize() errors. This happens when e.g. caching an object with a private field or when caching e.g. a JPEG file (starts with 0xFFD8FFE1) Fixes errors such as e.g.: unserialize(): Error at offset 20 of 24 bytes at caches/SQLiteCache.php line 51
Diffstat (limited to 'caches/SQLiteCache.php')
-rw-r--r--caches/SQLiteCache.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/caches/SQLiteCache.php b/caches/SQLiteCache.php
index d7ab1374..92235862 100644
--- a/caches/SQLiteCache.php
+++ b/caches/SQLiteCache.php
@@ -69,7 +69,7 @@ class SQLiteCache implements CacheInterface
$stmt = $this->db->prepare('INSERT OR REPLACE INTO storage (key, value, updated) VALUES (:key, :value, :updated)');
$stmt->bindValue(':key', $this->getCacheKey());
- $stmt->bindValue(':value', $blob);
+ $stmt->bindValue(':value', $blob, \SQLITE3_BLOB);
$stmt->bindValue(':updated', time());
$stmt->execute();
}