diff --git a/PropertyAccessor.php b/PropertyAccessor.php index 83f9a22..5f5c242 100644 --- a/PropertyAccessor.php +++ b/PropertyAccessor.php @@ -410,7 +410,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)