Skip to content

Assertion failure in ReflectionProperty::skipLazyInitialization after failed LazyProxy initialization (php_reflection.c) #20174

@vi3tL0u1s

Description

@vi3tL0u1s

Description

The following code:

<?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:

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

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions