Skip to content

Commit 8817d28

Browse files
[Cache] forbid serializing AbstractAdapter and TagAwareAdapter instances
1 parent 9fa32f4 commit 8817d28

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

+10
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ public function commit()
277277
return $ok;
278278
}
279279

280+
public function __sleep()
281+
{
282+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
283+
}
284+
285+
public function __wakeup()
286+
{
287+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
288+
}
289+
280290
public function __destruct()
281291
{
282292
if ($this->deferred) {

src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

+10
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ public function commit()
277277
return $this->invalidateTags([]);
278278
}
279279

280+
public function __sleep()
281+
{
282+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
283+
}
284+
285+
public function __wakeup()
286+
{
287+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
288+
}
289+
280290
public function __destruct()
281291
{
282292
$this->commit();

0 commit comments

Comments
 (0)