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