xref: /PHP-8.2/ext/reflection/tests/bug79820.phpt (revision 902d6439)
1--TEST--
2Bug #79820: Use after free when type duplicated into ReflectionProperty gets resolved
3--FILE--
4<?php
5
6#[AllowDynamicProperties]
7class Test {
8    public stdClass $prop;
9}
10
11$rp = new ReflectionProperty(Test::class, 'prop');
12$test = new Test;
13$test->prop = new stdClass;
14var_dump($rp->getType()->getName());
15$test->dynProp = 42;
16
17$rp = new ReflectionProperty($test, 'dynProp');
18var_dump($rp->getType());
19
20?>
21--EXPECT--
22string(8) "stdClass"
23NULL
24