[Semaphore] Dont allow unserializing classes with a destructor

This commit is contained in:
Nicolas Grekas 2020-12-09 11:20:03 +01:00
parent 2052534540
commit 92a2afb694

View File

@ -48,6 +48,16 @@ final class Semaphore implements SemaphoreInterface, LoggerAwareInterface
$this->logger = new NullLogger();
}
public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}
/**
* Automatically releases the underlying semaphore when the object is destructed.
*/