Skip to content

Commit ae40e4d

Browse files
Prevent destructors with side-effects from being unserialized
1 parent bf7ca5d commit ae40e4d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Legacy/SymfonyTestsListenerTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ public function __construct(array $mockedNamespaces = array())
8383
}
8484
}
8585

86+
public function __sleep()
87+
{
88+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
89+
}
90+
91+
public function __wakeup()
92+
{
93+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
94+
}
95+
8696
public function __destruct()
8797
{
8898
if (0 < $this->state) {

0 commit comments

Comments
 (0)