Skip to content

Commit 4aa44ec

Browse files
security #cve-2019-10912 [PHPUnit Bridge] Prevent destructors with side-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
1 parent 2a71753 commit 4aa44ec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SymfonyTestsListener.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ public function __construct(array $mockedNamespaces = array())
6161
}
6262
}
6363

64+
public function __sleep()
65+
{
66+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
67+
}
68+
69+
public function __wakeup()
70+
{
71+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
72+
}
73+
6474
public function __destruct()
6575
{
6676
if (0 < $this->state) {

0 commit comments

Comments
 (0)