Skip to content

Commit 4890206

Browse files
authored
BinLogCurrent object has changed format - catch Throwable in unserialize and clearCurrent (#14)
1 parent 155c7e1 commit 4890206

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Trigger.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use MySQLReplication\MySQLReplicationFactory;
2525
use ReflectionException;
2626
use ReflectionMethod;
27+
use Throwable;
2728

2829
class Trigger
2930
{
@@ -200,7 +201,12 @@ public function getCurrent(): ?BinLogCurrent
200201
return null;
201202
}
202203

203-
return unserialize($cache) ?: null;
204+
try {
205+
return unserialize($cache);
206+
} catch (Throwable $e) {
207+
$this->clearCurrent();
208+
return null;
209+
}
204210
}
205211

206212
/**

0 commit comments

Comments
 (0)