Skip to content

Typed property /w magic __get cannot be uninitialized #9389

Open
@mvorisek

Description

@mvorisek

Description

demo: https://3v4l.org/lDeXi

Currently, typed property can be "almost uninitialized" by unset().

But doing such uninitialization unsets the property and allows magic __get to kick in. This is expected and discussed in #9021.

Because of this, non-readonly typed property cannot be uninitialized properly. This is an issue in cases when the same object is to be restored, reused or cleaned.

To allow an object state to be restored/uninitialized correctly, I propose to add ReflectionProperty::setUninitialized() method and backport it into PHP 8.0 and above.

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