core
core copied to clipboard
AbstractFilter::denormalizePropertyName return typing issue
API Platform version(s) affected: 3.2.7
Description
We had an issue poping from nowhere saying the following : "ApiPlatform\Doctrine\Orm\Filter\AbstractFilter::denormalizePropertyName(): Return value must be of type string, int returned". After some investigations : we fond out that the denormalizePropertyName gets a string|int parameter, returns a string, but returns the parameter, which can be an int, as we can see here :
protected function denormalizePropertyName(string|int $property): string
{
if (!$this->nameConverter instanceof NameConverterInterface) {
return $property;
}
return implode('.', array_map($this->nameConverter->denormalize(...), explode('.', (string) $property)));
}
How to reproduce
Sadly I don't know how it happened yet, thus I'm not able to reproduce it.
Possible Solution
Either :
- Change return type to
string|int - Do not accept
intas a valid parameter
Additional context
ApiPlatform\Doctrine\Orm\Filter\AbstractFilter::denormalizePropertyName at line 83
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
to fix: cast as string