mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
Fix serialization implementation
This commit is contained in:
@@ -741,7 +741,7 @@ class Logger implements LoggerInterface, ResettableInterface
|
||||
{
|
||||
foreach (['name', 'handlers', 'processors', 'microsecondTimestamps', 'timezone', 'exceptionHandler', 'logDepth', 'detectCycles'] as $property) {
|
||||
if (isset($data[$property])) {
|
||||
$this->$property = $data;
|
||||
$this->$property = $data[$property];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -700,7 +700,11 @@ class LoggerTest extends \PHPUnit\Framework\TestCase
|
||||
public function testSerializable()
|
||||
{
|
||||
$logger = new Logger(__METHOD__);
|
||||
self::assertInstanceOf(Logger::class, unserialize(serialize($logger)));
|
||||
$copy = unserialize(serialize($logger));
|
||||
self::assertInstanceOf(Logger::class, $copy);
|
||||
self::assertSame($logger->getName(), $copy->getName());
|
||||
self::assertSame($logger->getTimezone()->getName(), $copy->getTimezone()->getName());
|
||||
self::assertSame($logger->getHandlers(), $copy->getHandlers());
|
||||
}
|
||||
|
||||
public function testReset()
|
||||
|
Reference in New Issue
Block a user