mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
ee7c7a8e26
Similar to what is done for ReflectionType itself, copy the type name stored inside ReflectionProperty. Also make sure the type field is always initialized for dynamic properties. This is a non-issue in PHP 8, because we store a pointer to the property_info there, rather than a copy.
23 lines
425 B
PHP
23 lines
425 B
PHP
--TEST--
|
|
Bug #79820: Use after free when type duplicated into ReflectionProperty gets resolved
|
|
--FILE--
|
|
<?php
|
|
|
|
class Test {
|
|
public stdClass $prop;
|
|
}
|
|
|
|
$rp = new ReflectionProperty(Test::class, 'prop');
|
|
$test = new Test;
|
|
$test->prop = new stdClass;
|
|
var_dump($rp->getType()->getName());
|
|
$test->dynProp = 42;
|
|
|
|
$rp = new ReflectionProperty($test, 'dynProp');
|
|
var_dump($rp->getType());
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(8) "stdClass"
|
|
NULL
|