1--TEST--
2Lazy objects: init exception 001
3--FILE--
4<?php
5
6#[AllowDynamicProperties]
7class C {
8    public int $a;
9    public $b;
10}
11
12$reflector = new ReflectionClass(C::class);
13
14for ($i = 0; $i < 2; $i++) {
15    $obj = $reflector->newLazyGhost(function ($obj) use ($i) {
16        if ($i === 1) {
17            throw new \Exception();
18        }
19    });
20    $obj->c = 1;
21}
22
23?>
24--EXPECTF--
25Fatal error: Uncaught Exception in %s:%d
26Stack trace:
27#0 %s(%d): {closure:%s:%d}(Object(C))
28#1 {main}
29  thrown in %s on line %d
30