-
-
Notifications
You must be signed in to change notification settings - Fork 933
Open
Labels
Description
API Platform version(s) affected: 3.1.4, 2.7.9
PHP version: 8.2.3
Description
On POST request to endpoint with JSON object where one property is numeric will be exception
"hydra:description": "ApiPlatform\\Serializer\\AbstractItemNormalizer::canAccessAttributePostDenormalize(): Argument #3 ($attribute) must be of type string, int given, called in /srv/app/vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php on line 227"
How to reproduce
- Set-up API Platform
- Send request
curl -vk --location 'https://localhost/greetings' \
--header 'Content-Type: application/json' \
--data '{
"0": 1
}'
or
curl 'https://demo.api-platform.com/books' -v -H 'content-type: application/ld+json' --data-raw '{"0":"1"}'
Possible Solution
As quick fix i locally inserted a row \ApiPlatform\Serializer\AbstractItemNormalizer:227
$attribute = (string)$attribute;