Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Neos.Utility.ObjectHandling/Classes/ObjectAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace Neos\Utility\ObjectHandling\Tests\Unit\Fixture;

/*
* This file is part of the Neos.Utility.ObjectHandling package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

/**
* Fixture class with public properties
*
*/

class DummyClassWithPublicProperties
{
public string $first = 'first';
public string $second;
public ?string = null;
}
Loading