Skip to content

Commit 7543b71

Browse files
authored
Fix the bug that Getting unserialized object from cache when using Trigger::getCurrent() (#6)
Co-authored-by: Deeka Wong <[email protected]>
1 parent cd91991 commit 7543b71

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: src/Trigger.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,13 @@ public function rememberCurrent(BinLogCurrent $binLogCurrent): void
197197
*/
198198
public function getCurrent(): ?BinLogCurrent
199199
{
200-
return with($this->cache->get($this->replicationCacheKey));
200+
return with($this->cache->get($this->replicationCacheKey), function ($cache) {
201+
if (! $cache) {
202+
return null;
203+
}
204+
205+
return unserialize($cache) ?: null;
206+
});
201207
}
202208

203209
/**

0 commit comments

Comments
 (0)