From ce754447c02d4a7b326e4e2ab7425c8bf51d2def Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 13 Jul 2023 17:18:52 +0200 Subject: [PATCH] [PropertyAccess] Fix access to undefined "file" key when checking stack frames --- src/Symfony/Component/PropertyAccess/PropertyAccessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index a611f2654ef83..1d9ed71d58ee5 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -470,7 +470,7 @@ private function readProperty(array $zval, string $property, bool $ignoreInvalid [$trace] = $e->getTrace(); // handle uninitialized properties in PHP >= 7 - if (__FILE__ === $trace['file'] + if (__FILE__ === ($trace['file'] ?? null) && $name === $trace['function'] && $object instanceof $trace['class'] && preg_match('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/', $e->getMessage(), $matches)