8000 [PropertyAccess] Class property ignored when unrelated methods are marked as ignored instead · Issue #45016 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[PropertyAccess] Class property ignored when unrelated methods are marked as ignored instead #45016
Closed
@Jeroeny

Description

@Jeroeny

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0