Skip to content

Commit 12593ad

Browse files
Merge branch '3.4' into 4.2
* 3.4: Prevent destructors with side-effects from being unserialized
2 parents c31080d + a43a2f6 commit 12593ad

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Legacy/CoverageListenerTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ private function findSutFqcn($test)
102102
return $sutFqcn;
103103
}
104104

105+
public function __sleep()
106+
{
107+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
108+
}
109+
110+
public function __wakeup()
111+
{
112+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
113+
}
114+
105115
public function __destruct()
106116
{
107117
if (!$this->warnings) {

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)