Skip to content

Commit c83fe9e

Browse files
Merge branch '5.4' into 6.0
* 5.4: [PropertyAccess] Fix on PHP < 7.4 [PropertyAccess] fix error msg when accessing typed but uninitializer public properties
2 parents 721978b + c5c851f commit c83fe9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PropertyAccessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ private function readProperty(array $zval, string $property, bool $ignoreInvalid
415415
throw $e;
416416
}
417417
} elseif (PropertyReadInfo::TYPE_PROPERTY === $type) {
418-
if (!method_exists($object, '__get') && !\array_key_exists($name, (array) $object)) {
418+
if (!method_exists($object, '__get') && !\array_key_exists($name, (array) $object) && !(new \ReflectionProperty($class, $name))->hasType()) {
419419
throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not initialized.', $class, $name));
420420
}
421421

0 commit comments

Comments
 (0)