8000 security #cve-2019-10912 [Cache][PHPUnit Bridge] Prevent destructors … · devloop42/symfony@b224d4f · GitHub
[go: up one dir, main page]

Skip to content

Commit b224d4f

Browse files
security #cve-2019-10912 [Cache][PHPUnit Bridge] Prevent destructors with side-effects from being unserialized (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [Cache][PHPUnit Bridge] Prevent destructors with side-effects from being unserialized | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Reported for `FilesystemCommonTrait` at https://www.intigriti.com/company/submission/CfDJ8Pja6NZvkpNCmx5vVyiGSn7yW8c1j4H0-cnAhIk6fbstOMm028X-XD1kmSuQkGB2n0cRyyVrA2yAiLN_I0EVilaKVLSiSa0UXZJGfN1h85vmk5c2dBBpu619r1YQEIjcXA Commits ------- 4fb9752 Prevent destructors with side-effects from being unserialized
1 parent 890cf89 commit b224d4f

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/Symfony/Bridge/PhpUnit/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) {

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ public function __construct(array $mockedNamespaces = [])
7474
}
7575
}
7676

77+
public function __sleep()
78+
{
79+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
80+
}
81+
82+
public function __wakeup()
83+
{
84+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
85+
}
86+
7787
public function __destruct()
7888
{
7989
if (0 < $this->state) {

src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ public function getLogDir()
6464
return $this->cacheDir;
6565
}
6666

67+
public function __sleep()
68+
{
69+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
70+
}
71+
72+
public function __wakeup()
73+
{
74+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
75+
}
76+
6777
public function __destruct()
6878
{
6979
$fs = new Filesystem();

src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ public static function throwError($type, $message, $file, $line)
116116
throw new \ErrorException($message, 0, $type, $file, $line);
117117
}
118118

119+
public function __sleep()
120+
{
121+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__); 6F8A
122+
}
123+
124+
public function __wakeup()
125+
{
126+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
127+
}
128+
119129
public function __destruct()
120130
{
121131
if (method_exists(parent::class, '__destruct')) {

0 commit comments

Comments
 (0)
0