1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +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

@@ -174,6 +174,9 @@ class NormalizerFormatter implements FormatterInterface
if ($data instanceof \JsonSerializable) {
/** @var null|scalar|array<array|scalar|null> $value */
$value = $data->jsonSerialize();
} elseif (\get_class($data) === '__PHP_Incomplete_Class') {
$accessor = new \ArrayObject($data);
$value = $accessor['__PHP_Incomplete_Class_Name'];
} elseif (method_exists($data, '__toString')) {
/** @var string $value */
$value = $data->__toString();