Skip to content

Commit 7510395

Browse files
committed
Dont allow unserializing classes with a destructor
1 parent 80d5743 commit 7510395

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Loader/Configurator/CollectionConfigurator.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ public function __construct(RouteCollection $parent, string $name, self $parentC
3636
$this->parentPrefixes = $parentPrefixes;
3737
}
3838

39+
public function __sleep()
40+
{
41+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
42+
}
43+
44+
public function __wakeup()
45+
{
46+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
47+
}
48+
3949
public function __destruct()
4050
{
4151
if (null === $this->prefixes) {

Loader/Configurator/ImportConfigurator.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ public function __construct(RouteCollection $parent, RouteCollection $route)
3030
$this->route = $route;
3131
}
3232

33+
public function __sleep()
34+
{
35+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
36+
}
37+
38+
public function __wakeup()
39+
{
40+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
41+
}
42+
3343
public function __destruct()
3444
{
3545
$this->parent->addCollection($this->route);

0 commit comments

Comments
 (0)