Closed
Description
Symfony version(s) affected
6.*
Haven't checked any older versions.
Description
Given I have a class like:
abstract class Bad
{
#[Ignore]
private bool $create = false;
#[Ignore]
private bool $delete = false;
private Uuid $id;
public function __construct(Uuid $id)
{
$this->id = $id;
}
...
$this->serializer->serialize(new BadOne(Uuid::v4()),'json');
// returns: {"foo":"foo"}
// expected: {"foo":"foo","id":"597eb634-7aff-4513-ba1c-c928e01ff60c"}
Now when a child class is (de)serialized, the id
property is marked as ignored and not included in the output. The linked reproducer should give some more details.
This could be a fairly critical bug in some cases, because if the serializer is user for DB entities, values can be lost.
How to reproduce
https://github.com/Jeroeny/reproduce/tree/annotate
Possible Solution
No response
Additional Context
No response