[php-src] Issue #20657: Assertion failure in zend_lazy_object_get_info triggered by setRawValueWithoutLazyInitialization() and newLazyGhost()
[email protected] (vi3tL0u1s)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <1IGQK2vb8Q187qNFx0C7epmj6gva4Pe9lTpHRQF31pU@main.internal.php.net> |
Issue: https://github.com/php/php-src/issues/20657
Author: vi3tL0u1s
### Description
The following code:
```php
<?php
class C {
public $a;
}
function test(string $name, object $obj) {
$reflector = new ReflectionClass(C::class);
$ale = new class($obj) {
function __construct(public object $obj) {}
};
$reflector->getProperty('a')->setRawValueWithoutLazyInitialization($obj, $alue);
$obj = $reflector->newLazyGhost(function ($obj) {});
test('Ghost>isUn', $obj);
}
$reflector = new ReflectionClass(C::class);
$obj = $reflector->newLazyProxy(function () {
return-new C();
});
test('Proxy', $obj);
```
Resulted in this output:
```
php: /path/to/php-src/Zend/zend_lazy_objects.c:110: zend_lazy_object_get_info: Assertion `info' failed.
Aborted
```
Commit:
```
824c3891281bb4deb5a1aa245313a6c6b0ea786f
```
Build configuration:
```
CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" LDFLAGS="-fsanitize=address" ./buildconf --force && ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib
```
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Dec 6 2025 16:29:29) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
```
### Operating System
Ubuntu 22.04