diff --git a/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php b/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php index 89decda676..30087becb7 100644 --- a/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php +++ b/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php @@ -185,7 +185,9 @@ protected static function initializePropertyGetterCache(string $cacheIdentifier, if ($subject instanceof \ArrayAccess) { return; } - if (array_key_exists($propertyName, get_object_vars($subject))) { + $properties = array_map(fn(\ReflectionProperty $property) => $property->getName(), (new \ReflectionClass($subject))->getProperties(\ReflectionProperty::IS_PUBLIC)); + + if (in_array($propertyName, $properties)) { self::$propertyGetterCache[$cacheIdentifier]['publicProperty'] = $propertyName; } } diff --git a/Neos.Utility.ObjectHandling/Tests/Unit/Fixture/DummyClassWithPublicProperties.php b/Neos.Utility.ObjectHandling/Tests/Unit/Fixture/DummyClassWithPublicProperties.php new file mode 100644 index 0000000000..5a5052ebba --- /dev/null +++ b/Neos.Utility.ObjectHandling/Tests/Unit/Fixture/DummyClassWithPublicProperties.php @@ -0,0 +1,24 @@ +