Skip to content

Primed SIMPLE_WRITE cache slot in ASSIGN_OBJ skips lazy init #17998

Closed

Description

@iluuu1994

Description

The following code:

class C {
    public $prop {
        set => $value;
    }
}

$nonLazy = new C;

$lazy = (new ReflectionClass(C::class))->newLazyProxy(function () {
    echo "init\n";
    return new C;
});

function foo(C $c) {
    $c->prop = 1;
    var_dump($c->prop);
}

foo($nonLazy);
foo($lazy);

Resulted in this output:

int(1)
int(1)

But I expected this output instead:

int(1)
init
int(1)

PHP Version

8.4

Operating System

No response

Activity

  1. self-assigned this
    on Mar 7, 2025
  2. added a commit that references this issue on Mar 8, 2025
    9acfe6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions