Skip to content

Commit

Permalink
security #cve-2019-10912 [PHPUnit Bridge] Prevent destructors with si…
Browse files Browse the repository at this point in the history
…de-effects from being unserialized (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[PHPUnit Bridge] Prevent destructors with side-effects from being unserialized

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

908b64d17e [2.8][PHPUnit Bridge] Prevent destructors with side-effects from being unserialized - CVE-2019-10912
  • Loading branch information
nicolas-grekas committed Apr 16, 2019
1 parent 2a71753 commit 4aa44ec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SymfonyTestsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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 4aa44ec

Please sign in to comment.