From 0249e46f69e92049a488f39fcf531cb42c50caaa 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 --- PropertyAccessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PropertyAccessor.php b/PropertyAccessor.php index a611f26..1d9ed71 100644 --- a/PropertyAccessor.php +++ b/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)