1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-09 06:36:46 +02:00

Fix fatal error in NormalizeFormatter: method_exists(): The script tried to execute a method or access a property of an incomplete object.

Closes #1833
Fixes #1834
This commit is contained in:
Egor Korobov
2023-09-08 17:40:20 +03:00
committed by Jordi Boggiano
parent 70e1c2f405
commit ed80d53ab2
2 changed files with 17 additions and 0 deletions

View File

@@ -415,6 +415,20 @@ class NormalizerFormatterTest extends TestCase
);
}
public function testCanNormalizeIncompleteObject(): void
{
$serialized = "O:17:\"Monolog\TestClass\":1:{s:23:\"\x00Monolog\TestClass\x00name\";s:4:\"test\";}";
$object = unserialize($serialized);
$formatter = new NormalizerFormatter();
$record = ['context' => ['object' => $object]];
$result = $formatter->format($record);
$this->assertEquals([
'__PHP_Incomplete_Class' => 'Monolog\\TestClass',
], $result['context']['object']);
}
private function throwHelper($arg)
{
throw new \RuntimeException('Thrown');