Skip to content

Commit dc9d203

Browse files
authored
Fix error with deserializing (#32)
1 parent 0502936 commit dc9d203

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/RemoteEntity/Cache/Cacher.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ public function fetch(
3838
return $object;
3939
}
4040

41-
public function get(string $id, string $type): object
41+
public function get(string $id, string $type): ?object
4242
{
4343
$objectId = $this->getObjectId($id, $type);
44-
return unserialize($this->kvStorageConfigAccessor->getKvStorage()->get($objectId));
44+
$object = $this->kvStorageConfigAccessor->getKvStorage()->get($objectId);
45+
if (empty($object)) {
46+
return null;
47+
}
48+
49+
return unserialize($object);
4550
}
4651

4752
private function getObjectId(string $id, string $type): string

0 commit comments

Comments
 (0)