Merge branch '3.4' into 4.2

* 3.4:
  Prevent destructors with side-effects from being unserialized
This commit is contained in:
Nicolas Grekas 2019-04-16 11:03:50 +02:00
commit 4b18b32133
4 changed files with 40 additions and 0 deletions

View File

@ -102,6 +102,16 @@ class CoverageListenerTrait
return $sutFqcn;
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
if (!$this->warnings) {

View File

@ -83,6 +83,16 @@ class SymfonyTestsListenerTrait
}
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
if (0 < $this->state) {

View File

@ -64,6 +64,16 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface
return $this->cacheDir;
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
$fs = new Filesystem();

View File

@ -122,6 +122,16 @@ trait FilesystemCommonTrait
throw new \ErrorException($message, 0, $type, $file, $line);
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
public function __destruct()
{
if (method_exists(parent::class, '__destruct')) {