Closed as not planned
Closed as not planned
Description
Symfony version(s) affected
7.2
Description
I used to be able to serialize the method getrp() in lowercase. Now it doesn't serialize unless I rename it to getRp().
How to reproduce
#[Groups(['rp', 'transitions', 'searchable'])]
public function getrp(?array $addlParams = []): array
{
return array_merge($this->getUniqueIdentifiers(), $addlParams);
}
This serializes with 7.0 and until recently, 7.1. It no longer works.
Possible Solution
In 7.0, AttributeLoader.php looked line this:
$accessorOrMutator = preg_match('/^(get|is|has|set)(.+)$/i', $method->name, $matches);
if ($accessorOrMutator) {
$attributeName = lcfirst($matches[2]);
if (isset($attributesMetadata[$attributeName])) {
$attributeMetadata = $attributesMetadata[$attributeName];
} else {
$attributesMetadata[$attributeName] = $attributeMetadata = new AttributeMetadata($attributeName);
$classMetadata->addAttributeMetadata($attributeMetadata);
}
}
Recently, it changed:
$accessorOrMutator = preg_match('/^(get|is|has|set)(.+)$/i', $method->name, $matches);
if ($accessorOrMutator && !ctype_lower($matches[2][0])) {
$attributeName = lcfirst($matches[2]);
if (isset($attributesMetadata[$attributeName])) {
$attributeMetadata = $attributesMetadata[$attributeName];
} else {
$attributesMetadata[$attributeName] = $attributeMetadata = new AttributeMetadata($attributeName);
$classMetadata->addAttributeMetadata($attributeMetadata);
}
}
Additional Context
No response