From 7d51fa0efbb9fbdf2e9492b733462ec99e6f427b Mon Sep 17 00:00:00 2001 From: lalshe Date: Tue, 3 Dec 2019 22:47:21 +0200 Subject: [PATCH] Catch more specific error, expand tracked message --- src/Symfony/Extensions/PropertyNormalizerWrapper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Extensions/PropertyNormalizerWrapper.php b/src/Symfony/Extensions/PropertyNormalizerWrapper.php index 491cfe4..9082836 100644 --- a/src/Symfony/Extensions/PropertyNormalizerWrapper.php +++ b/src/Symfony/Extensions/PropertyNormalizerWrapper.php @@ -60,7 +60,7 @@ protected function extractAttributes(object $object, string $format = null, arra /** * {@inheritdoc} * - * @throws \Throwable + * @throws \Error */ protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) { @@ -73,14 +73,14 @@ protected function getAttributeValue(object $object, string $attribute, string $ { return parent::getAttributeValue($object, $attribute, $format, $context); } - catch (\Throwable $throwable) + catch (\Error $error) { - if (\strpos($throwable->getMessage(), 'before initialization') !== false) + if (\strpos($error->getMessage(), 'must not be accessed before initialization') !== false) { return null; } - throw $throwable; + throw $error; } }