[php-src] Issue #20174: Assertion failure in ReflectionProperty::skipLazyInitialization after failed LazyProxy initialization (php_reflection.c)
| From: | vi3tL0u1s | Date: | Wed, 15 Oct 2025 08:35:05 +0000 |
| Subject: | [php-src] Issue #20174: Assertion failure in ReflectionProperty::skipLazyInitialization after failed LazyProxy initialization (php_reflection.c) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251064@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20174
Author: vi3tL0u1s
### Description
The following code:
```php
<?php
class C {
public $b;
}
$reflector = new ReflectionClass(C::class);
$obj = $reflector->newLazyProxy(function ($obj) {
$obj->b = 4;
throw new Exception();
});
try {
$reflector->initializeLazyObject($obj);
} catch (Exception $e) {
$reflector->getProperty('b')->skipLazyInitialization($obj);
}
?>
```
Resulted in this output:
```
php: /path/to/php-src/ext/reflection/php_reflection.c:6266:
zim_ReflectionProperty_skipLazyInitialization: Assertion `zval_get_type(&(*(dst))) == 0
&& "Lazy property should be UNDEF"' failed.
Aborted
```
Commit:
```
e2da92b15c7
```
Configurations:
```bash
CC="gcc" CXX="g++" CFLAGS="-fsanitize=address -g -O0"
CXXFLAGS="-fsanitize=address -g -O0" ./configure --enable-debug --enable-address-sanitizer
--disable-shared --with-pic
```
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Oct 15 2025 13:52:11) (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