Closed
Description
Symfony version(s) affected: 5.1.0+
Description
Prior to 5.1.0 the getsetter
method was checked second after getter
.
See https://github.com/symfony/symfony/blob/v5.0.9/src/Symfony/Component/PropertyAccess/PropertyAccessor.php#L479-L482 for prior logic.
After moving the logic into the PropertyInfo component get getsetter
is checked after prefixed accessors.
See https://github.com/symfony/property-info/blob/master/Extractor/ReflectionExtractor.php#L239-L253
How to reproduce
Given the following class
class Order
{
private array $payments = [];
public function payments(): array
{
return $this->payments;
}
public function hasPayments(): bool
{
return count($this->payments) > 0;
}
}
trying to access payments
will return a boolean value instead of the the array by accessing the hasPayments()
instead of the payments()
method.