You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Classes with private properties do not react as epxected to ObjectAccess::setProperty() with $forceDirectAccess enabled.
Steps to Reproduce
Have a class wirh a private property that is proxied for DI/AOP purposes. You end up with a structure like this:
class SomeClass_Original {
private $property = 'initial';
public function showProperty() {
echo $this->property;
}
}
class SomeClass extends SomeClass_Original {
// DI and AOP code built by Flow
}
$subject = new SomeClass();
I don't think that this change would break anything so +1 for the idea.
The hard-coded '_Original' should probably replaced with Neos\Flow\ObjectManagement\Proxy\Compiler::ORIGINAL_CLASSNAME_SUFFIX though.
Or even with sth like:
…ied classes
With this classes with private properties do react as expected to
ObjectAccess::getProperty() and ObjectAccess::setProperty() with
$forceDirectAccess enabled, even when they have been subclassed by the
proxy building of Flow.
Fixesneos#2388
Description
Classes with private properties do not react as epxected to
ObjectAccess::setProperty()
with$forceDirectAccess
enabled.Steps to Reproduce
Have a class wirh a private property that is proxied for DI/AOP purposes. You end up with a structure like this:
ObjectAccess::setProperty($subject, 'changed', true)
$subject->showProperty
Expected behavior
Property is set in "original" class and output is:
changed
Actual behavior
Property is set in proxy class and output is:
initial
Affected Versions
Flow: effectively all, the code in question is unchanged for the last 6 years.
Possible solution
Change
flow-development-collection/Neos.Utility.ObjectHandling/Classes/ObjectAccess.php
Lines 250 to 257 in 1a4e6ba
Question – do we want this?
The text was updated successfully, but these errors were encountered: