Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[symfony/var-exporter] Warning: Undefined array key 3 at &__get($name) #52826

Closed as not planned
@shakaran

Description

@shakaran

Symfony version(s) affected

7.0.0

Description

Getting a field which is a oneToMany reach this part of code

https://github.com/symfony/var-exporter/blob/7.0/LazyGhostTrait.php#L112

Where is not checked with isset() if the key index exist or not properly, assuming always that it is present.

I am using PHP 8.2

How to reproduce

I have a User class with that OneToMany

#[Ignore]
#[ORM\OneToMany(mappedBy: 'followingUser', targetEntity: Follower::class, fetch: 'EXTRA_LAZY', cascade: ['persist', 'remove'], orphanRemoval: true)]
public null|Collection|array $followings = null;

Possible Solution

Check the index at least with isset()

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