Skip to content

Commit 6ffdbdd

Browse files
bug #39795 Dont allow unserializing classes with a destructor - 5.1 (jderusse)
This PR was merged into the 5.1 branch. Discussion ---------- Dont allow unserializing classes with a destructor - 5.1 | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Prevent destructors with side-effects from being unserialized Commits ------- 07402f4af3 Dont allow unserializing classes with a destructor - 5.1
2 parents c6b166e + f3f0fe5 commit 6ffdbdd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Response/AmpResponse.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ public function getInfo(string $type = null)
109109
return null !== $type ? $this->info[$type] ?? null : $this->info;
110110
}
111111

112+
public function __sleep()
113+
{
114+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
115+
}
116+
117+
public function __wakeup()
118+
{
119+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
120+
}
121+
112122
public function __destruct()
113123
{
114124
try {

0 commit comments

Comments
 (0)