php / php-src

The PHP Interpreter
https://www.php.net
Other
38.17k stars 7.75k forks source link

Core dumped in Zend/zend_lazy_objects.c #15823

Closed YuanchengJiang closed 1 month ago

YuanchengJiang commented 1 month ago

Description

The following code:

<?php
class C {
public int $a = 1;
}
function test(string $name, object $obj) {
var_dump($obj);
}
$reflector = new ReflectionClass(C::class);
$obj = $reflector->newLazyGhost(function ($obj) {
throw new Error("initializer");
});
test('Proxy', $obj);
json_encode($obj, 0, 540);

Resulted in this output:

/php-src/Zend/zend_lazy_objects.c:627: HashTable *zend_lazy_object_get_properties(zend_object *): Assertion `!object->properties || object->properties == &zend_empty_array' failed.
Aborted (core dumped)

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

cmb69 commented 1 month ago

cc @arnaud-lb, @nicolas-grekas

arnaud-lb commented 1 month ago

Thank you @YuanchengJiang