-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Description
Description
The following code:
<?php
class C {
public $a {
get { return $this->a; }
set($value) { $this->a = $value; }
}
public function __construct(int $a) {}
}
function test(string $name, object $obj) {
var_dump($obj->a);var_dump($obj);
}
$reflector = new ReflectionClass(C::class);var_dump($reflector);
$obj = $reflector->newLazyGhost(function ($obj) {
$obj->__construct(1);var_dump($obj);
});
test('Ghost', $obj);var_dump($obj);
$obj = $reflector->newLazyProxy(function ($obj) {
return new C(1);
});
test('Proxy', $obj);var_dump($obj);
?>
Resulted in this output (JIT 1211):
object(ReflectionClass)#1 (1) {
["name"]=>
string(1) "C"
}
object(C)#3 (1) {
["a"]=>
NULL
}
NULL
object(C)#3 (1) {
["a"]=>
NULL
}
object(C)#3 (1) {
["a"]=>
NULL
}
*RECURSION*
Segmentation fault (core dumped)
But I expected this output instead:
object(ReflectionClass)#1 (1) {
["name"]=>
string(1) "C"
}
object(C)#3 (1) {
["a"]=>
NULL
}
NULL
object(C)#3 (1) {
["a"]=>
NULL
}
object(C)#3 (1) {
["a"]=>
NULL
}
NULL
lazy proxy object(C)#4 (1) {
["instance"]=>
object(C)#3 (1) {
["a"]=>
NULL
}
}
lazy proxy object(C)#4 (1) {
["instance"]=>
object(C)#3 (1) {
["a"]=>
NULL
}
}
PHP Version
nightly
Operating System
ubuntu 22.04