Skip to content

PHP8.2 - isset() not properly handled on objects with dynamic properties #8496

@amooij

Description

@amooij

Bug report

I am upgrading some code to PHP8.2 using PHPStan to discover possible issues.
I have a class that defines a __set and __get magic function, as well as the magic __isset function.
If I access or write any properties on this class, no errors occur, but if I use
if (isset($instance->x))
I get:
Access to an undefined property class::$x

Code snippet that reproduces the problem

I tried but I get a different unexpected error.

https://phpstan.org/r/d253ad7c-9651-44b4-bce9-b95358d812c2

Expected output

No error

Did PHPStan help you today? Did it make you happy in any way?

We have a love-hate relationship :-).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions