- Notifications
You must be signed in to change notification settings - Fork8k
Closed
Labels
Description
Description
Access to properties of a lazy proxy are forwarded to the real instance. But if the access is made by a magic method, forwarding to the real instance may call the magic method again:
#[AllowDynamicProperties]class C {public$_;publicfunction__set($name,$value) {var_dump(__METHOD__);$this->$name =$value *2; }}$rc =newReflectionClass(C::class);$obj =$rc->newLazyProxy(function () {echo"init\n";returnnewC;});$obj->prop =1;var_dump($obj->prop);
Resulted in this output:
string(8) "C::__set"initstring(8) "C::__set"int(4)
But I expected this output instead:
string(8) "C::__set"initint(2)
PHP Version
PHP 8.4
Operating System
No response