Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Validator] Typed property must not be accessed before initialization #35454

Copy link
Copy link
Closed
@greedyivan

Description

@greedyivan
Issue body actions

Related: doctrine/orm#7944

Description:
This is the same issue when ReflectionProperty::getValue() uses an uninitialized argument.

How to reproduce:
Validate an object that has an uninitialized property with type hint:

    /**
     * @Assert\NotBlank()
     */
    public int $id;

Possible Solution:
Something similar to TypedNoDefaultReflectionProperty.php
Symfony\Component\Validator\Mapping\PropertyMetadata::getPropertyValue:

    /**
     * {@inheritdoc}
     */
    public function getPropertyValue($object)
    {
        $reflectionProperty = $this->getReflectionMember($object);

        return $object !== null && $reflectionProperty->isInitialized($object) ? $reflectionProperty->getValue($object) : null;
    }

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.