Skip to content

Primed SIMPLE_WRITE cache slot in ASSIGN_OBJ skips lazy init #17998

Closed
@iluuu1994

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions