fix(sqlitecache): bug in prior refactor (#3540)

fixes:

rssbridge.WARNING Trying to access array offset on value of type bool at caches/SQLiteCache.php line 72
This commit is contained in:
Dag 2023-07-16 05:29:56 +02:00 committed by GitHub
parent e8420b9f39
commit 773eea196f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,12 +41,14 @@ class SQLiteCache implements CacheInterface
$result = $stmt->execute();
if ($result) {
$row = $result->fetchArray(\SQLITE3_ASSOC);
$blob = $row['value'];
$data = unserialize($blob);
if ($data !== false) {
return $data;
if ($row !== false) {
$blob = $row['value'];
$data = unserialize($blob);
if ($data !== false) {
return $data;
}
Logger::error(sprintf("Failed to unserialize: '%s'", mb_substr($blob, 0, 100)));
}
Logger::error(sprintf("Failed to unserialize: '%s'", mb_substr($blob, 0, 100)));
}
return null;
}
@ -69,7 +71,9 @@ class SQLiteCache implements CacheInterface
$result = $stmt->execute();
if ($result) {
$row = $result->fetchArray(\SQLITE3_ASSOC);
return $row['updated'];
if ($row !== false) {
return $row['updated'];
}
}
return null;
}