Skip to content

Commit cc25ec0

Browse files
bug #39794 Dont allow unserializing classes with a destructor - 4.4 (jderusse)
This PR was merged into the 4.4 branch. Discussion ---------- Dont allow unserializing classes with a destructor - 4.4 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Prevent destructors with side-effects from being unserialized Commits ------- 955395c999 Dont allow unserializing classes with a destructor - 4.4
2 parents 6cd763b + e5e0712 commit cc25ec0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Transport/Smtp/SmtpTransport.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,16 @@ private function checkRestartThreshold(): void
340340
$this->restartCounter = 0;
341341
}
342342

343+
public function __sleep()
344+
{
345+
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
346+
}
347+
348+
public function __wakeup()
349+
{
350+
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
351+
}
352+
343353
public function __destruct()
344354
{
345355
$this->stop();

0 commit comments

Comments
 (0)