Skip to content

Commit

Permalink
Prevent destructors with side-effects from being unserialized
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Apr 2, 2019
1 parent bf7ca5d commit ae40e4d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Legacy/SymfonyTestsListenerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ public function __construct(array $mockedNamespaces = array())
}
}

public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}

public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

public function __destruct()
{
if (0 < $this->state) {
Expand Down

0 comments on commit ae40e4d

Please sign in to comment.